diff --git a/.gitignore b/.gitignore index 4a1ea1f6c..438ec13fc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ vendor/ .php_cs.cache dist/ bin/ +!bin/test.sh vendor-bin/*/vendor/ humbuglog.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a59431b6a..acbf233de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,9 +25,13 @@ Main differences between 2.x and 3.x: The two entry points of the library are the `DataLoader` and `FileLoader`: -![FileLoader](doc/img/FileLoader.png) + + FileLoader + -![DataLoader](doc/img/DataLoader.png) + + DataLoader + Alice's goal is to render a PHP array containing a description of objects and parameters (with support for injected external objects and parameters) into a set of objects called `ObjectSet`. @@ -103,24 +107,19 @@ services with the right properties (like tags and configuration) to the framewor other framework special features should be handled in another library, bundle, module etc. To avoid any conflicts, the framework dependencies used by the bridges are installed in dedicated folders thanks to -[bamarni composer plugin][3]. As a result, if you want to run the tests for Symfony, you must run the tests with +[bamarni bin composer plugin][3] and [theofidry inheritance composer plugin][4]. As a result, if you want to run the tests for Symfony, you must run the tests with `phpunit_symfony.xml.dist` instead of `phpunit.xml.dist`. -The test suite also uses the groups annotations: - -- `integration`: integration tests -- `symfony`: Symfony bridge related tests -- no group: any unit test - -For example to run only the Symfony bridge integration tests: - -`$ vendor/bin/phpunit -c phpunit_symfony.xml.dist --group=integration,symfony` +To run the tests, simply run `bin/tests.sh`. The tests should be descriptive and are "testdox friendly" i.e. if you are using the testdox option, you will get something like: -![Testdox](doc/img/testdox.png) + + Testdox + [1]: https://github.com/fzaninotto/Faker [2]: https://github.com/sebastianbergmann/phpunit [3]: https://github.com/bamarni/composer-bin-plugin +[4]: https://github.com/theofidry/composer-inheritance-plugin diff --git a/bin/tests.sh b/bin/tests.sh new file mode 100755 index 000000000..151a1a16f --- /dev/null +++ b/bin/tests.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# +# This file is part of the Alice package. +# +# (c) Nelmio +# +# For the full copyright and license information, please view the LICENSE +# file that was distributed with this source code. +# + +export INFO_COLOR="\e[34m" +export NO_COLOR="\e[0m" + +log() { + local message=$1; + echo -en "${INFO_COLOR}${message}${NO_COLOR}\n"; +} + +set -e + +log "Core library" +vendor/bin/phpunit -c phpunit.xml.dist + +log "Symfony bridge" +rm -rf fixtures/Bridge/Symfony/Application/cache/* + +vendor-bin/symfony/bin/phpunit -c phpunit_symfony.xml.dist diff --git a/tests/Bridge/Symfony/Application/AppKernel.php b/fixtures/Bridge/Symfony/Application/AppKernel.php similarity index 100% rename from tests/Bridge/Symfony/Application/AppKernel.php rename to fixtures/Bridge/Symfony/Application/AppKernel.php diff --git a/tests/Bridge/Symfony/Application/AppKernelWithCustomParameters.php b/fixtures/Bridge/Symfony/Application/AppKernelWithCustomParameters.php similarity index 100% rename from tests/Bridge/Symfony/Application/AppKernelWithCustomParameters.php rename to fixtures/Bridge/Symfony/Application/AppKernelWithCustomParameters.php diff --git a/tests/Bridge/Symfony/Application/config.yml b/fixtures/Bridge/Symfony/Application/config.yml similarity index 100% rename from tests/Bridge/Symfony/Application/config.yml rename to fixtures/Bridge/Symfony/Application/config.yml diff --git a/tests/Bridge/Symfony/Application/config_custom.yml b/fixtures/Bridge/Symfony/Application/config_custom.yml similarity index 100% rename from tests/Bridge/Symfony/Application/config_custom.yml rename to fixtures/Bridge/Symfony/Application/config_custom.yml diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aeabc0188..28d275711 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,4 +1,14 @@ + + + tests/FixtureBuilder/ExpressionLanguage/TokenTest.php - tests/ + tests + tests/Bridge - - - symfony - - - src + src/Bridge diff --git a/phpunit_symfony.xml.dist b/phpunit_symfony.xml.dist index 22fac7fb1..245e52d4d 100644 --- a/phpunit_symfony.xml.dist +++ b/phpunit_symfony.xml.dist @@ -1,4 +1,5 @@ +