An example laravel project using TDD with an external database.
The article on this can be found here.
Clone this repo
git clone [email protected]:AlanHolmes/tdd-with-external-db-example.git
Boot up the docker container
(skip this step if you aren't using docker)
docker-compose up -d
Env file
- Copy
.env.example
to.env
- Change the
DB_*
andDB_EXTERNAL_*
settings as required
Composer
Run composer install
or if don't have the correct version of php (^7.1.3
), run it inside the docker container.
docker-compose exec php composer install
Final Step
Run php artisan key:generate
to set APP_KEY
Or again, inside the docker container.
docker-compose exec php artisan key:generate
Now that you are all setup, you can run the unit tests within the docker container.
docker-compose exec php php ./vendor/bin/phpunit
This example is open-sourced software licensed under the MIT license.