Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Laravel with PHP unit trying to connect to Microsoft SQL server

I am trying to run unit/integration tests via pipeline and using PHP unit. The DB server is Microsoft SQL.

Here's an excerpt of bitbucket-pipelines.yml

image: php:7.1.29

pipelines:
branches:
unittest:
- step:
name: New Unit Tests
caches:
- composer
script:
- mv "env/.env-unit" ".env"
# - php artisan migrate --seed
- mv -f "public/azure.web.config" "public/web.config"
- apt-get update && apt-get install -y unzip zip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- php artisan migrate --seed
# might need to wait for sqlserver to start properly here
# - sqlcmd -S localhost,1433 -U SA -P 'ThePassword' -i myhsm.sql
- vendor/bin/phpunit --bootstrap vendor/autoload.php
- zip -r unit_deployment.zip .
services:
- sqlserver
artifacts:
- unit_deployment.zip
definitions:
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2017-latest
variables:
ACCEPT_EULA: Y
SA_PASSWORD: ThePassword

 

It will either error out if I tried the php artisan migrate or sqlcmd is not available in this image to import the DB data. Otherwise, in the sqlserver tab things look okay. I think it comes down to getting this script to be able to import the data. Otherwise there'll be lots of 

1) Tests\Unit\OrganisationControllerTest::testExample
Doctrine\DBAL\Driver\PDOException: could not find driver

 errors. Any suggestions on how to get MSSQL connected so my unit/integration tests can proceed?

 

1 answer

1 accepted

0 votes
Answer accepted

It looks like that the build image you use - php:7.1.29 - does not have the PDO Driver for MSSQL configured / enabled.

The official PHP docker images have pre-made routines to enable PHP extensions. You can first start with a shell script executing this in context of the pipeline and then port it into a Dockerfile for your own build container that ships with the expected configuration.

 

Please see https://hub.docker.com/_/php the section How to install more PHP extensions which has this information.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

777 views 15 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you