Traits for solving the most common problems.
Create a class with the getHttpClient method, example: src/ExampleTestCase.php
When you write "YourTest extends \YaPro\SymfonyHttpTestExt\BaseTestCase" you will get the function:
- $this->getHttpClient() - for working with http client
- $this->getJsonHelper() - for working with json
- $this->assertXXX() - for working with assert, example: assertJsonResponse($json)
- etc: AssertionsTrait, ExtTrait
- Доступ к внутренним объектам - https://symfony.com/doc/current/testing.html#accessing-internal-objects
- Профилировщик - https://symfony.com/doc/current/testing.html#accessing-the-profiler-data
- Http Переадресация - https://symfony.com/doc/current/testing.html#redirecting
- Отключаем перехват исключений - https://symfony.com/doc/current/testing.html#reporting-exceptions.
docker build -t yapro/symfony-http-test-ext:latest -f ./Dockerfile ./
docker run --rm -v $(pwd):/app yapro/symfony-http-test-ext:latest bash -c "cd /app \
&& composer install --optimize-autoloader --no-scripts --no-interaction \
&& /app/vendor/bin/phpunit /app/tests"
docker build -t yapro/symfony-http-test-ext:latest -f ./Dockerfile ./
docker run -it --rm -v $(pwd):/app -w /app yapro/symfony-http-test-ext:latest bash
composer install -o