To install the project:
php composer.phar create-project carloscasalar/basketball-manager-advisor [path] *
You will have an empty src/
directory and a phpunit.xml.dist
that is configured to run all the PHPUnit tests
names *Test.php
in the directories src/*/Tests
(and their subdirectories). When you use this configuration the
Composer autoloader will be initialized automatically to make sure that every namespaced class inside src/
can be
auto-loaded from within the test cases.
If you don't want to install php in your system you can install this project with this command:
docker run --rm -v /YOUR/LOCAL/PROJECTS/DIR:/opt -w /opt shippingdocker/php-composer:latest composer create-project carloscasalar/basketball-manager-advisor basketball-manager-advisor
Where /YOUR/LOCAL/PROJECTS/DIR
is the local folder where this project will be installed.
- Choose
Run
,Edit configurations...
and remove any existing configuration. - Select
Defaults - PHPUnit
, put a check beforeUse alternative configuration file
and selectphpunit.xml.dist
from this project. - Click the button to the right of this field. In the dialog that appears select
Use custom loader
and select the filevendor/autoload.php
inside your project. This will make sure PHPStorm uses the bundled version of PHPUnit.
To validate your setup once you have installed this project, run the tests: right-click on the src/
directory and
then select Run 'src'
.
You can run the tests from the command-line:
php vendor/bin/phpunit
When you first run the tests, PHPStorm might ask you to supply a PHP interpreter.
Or you can run the test without install php with docker:
docker run --rm -it -v /YOUR/LOCAL/PROJECTS/DIR/basketball-manager-advisor:/opt -w /opt shippingdocker/php-composer:latest composer run-script test
To show a list of all tests being launched:
docker run --rm -it -v /YOUR/LOCAL/PROJECTS/DIR/basketball-manager-advisor:/opt -w /opt shippingdocker/php-composer:latest composer run-script test-checklist
You can run de app with the following command:
php bin/console
Also with composer command run
:
composer run-script run
If you don't have php or composer installed in your system you can run it with docker
docker run --rm -it -v /YOUR/LOCAL/PROJECTS/DIR/basketball-manager-advisor:/opt -w /opt shippingdocker/php-composer:latest php bin/console.php
docker run --rm -it -v /YOUR/LOCAL/PROJECTS/DIR/basketball-manager-advisor:/opt -w /opt shippingdocker/php-composer:latest composer run-script run
You can use matthiasnoback's PHPUnit cheatsheet as a quick reference for PHPUnit usage.
This project structure is based in matthiasnoback/php-coding-dojo.
Also thanks to shipping-docker/php-composer for sharing the docker commands.