2021-06-05 21:09:18 +00:00
|
|
|
# Building the development environment
|
|
|
|
|
2021-06-11 08:33:26 +00:00
|
|
|
cd into the project directory and run the following command: `sh bin/startdocker.sh`
|
2021-06-05 21:09:18 +00:00
|
|
|
This should start building the images and start the containers.
|
|
|
|
|
|
|
|
After that you need to go into the controlpanel_php container and run some commands:
|
|
|
|
|
|
|
|
Type `docker exec -it controlpanel_php ash` to go into the container and run the following commands:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
composer install
|
2021-06-12 10:58:04 +00:00
|
|
|
cp .env.example .env
|
2021-06-05 21:09:18 +00:00
|
|
|
php artisan key:generate --force
|
|
|
|
php artisan storage:link
|
|
|
|
php artisan migrate --seed --force
|
|
|
|
```
|
2021-06-09 18:53:58 +00:00
|
|
|
|
|
|
|
## Setting up testing environment
|
|
|
|
|
2021-06-12 10:58:04 +00:00
|
|
|
Create the .env.testing file to your needs. Then once done you need to go into your phpmyadmin to create a new database named __controlpanel_test__.
|
2021-06-09 18:53:58 +00:00
|
|
|
Visit http://127.0.0.1:8080/ and create your database.
|
|
|
|
|
|
|
|
Now you're ready to run the following commands which switches to the testing config, migrates the test database and seeds it.
|
|
|
|
After that you can switch back to your dev environment again. Clear the config from cache so changes will be instantly available.
|
|
|
|
|
|
|
|
```shell
|
2021-06-12 10:58:04 +00:00
|
|
|
php artisan key:generate --force --env=testing
|
2021-06-11 08:33:26 +00:00
|
|
|
php artisan migrate:fresh --seed --env=testing
|
2021-06-09 18:53:58 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Now when running tests with PHPUnit it will use your testing database and not your local development one.
|
|
|
|
This is configured in the __phpunit.xml__. You can run your tests by running the command like this. Just type and enter.
|
2021-06-09 20:56:15 +00:00
|
|
|
`php artisan test`.
|
2021-06-09 18:53:58 +00:00
|
|
|
|
|
|
|
|