Download the PHP package speicher210/functional-test-bundle without Composer
On this page you can find all versions of the php package speicher210/functional-test-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download speicher210/functional-test-bundle
More information about speicher210/functional-test-bundle
Files in speicher210/functional-test-bundle
Package functional-test-bundle
Short Description Symfony bundle for functional testing
License MIT
Informations about the package functional-test-bundle
Speicher210 Functional Test Bundle
Introduction
This Bundle provides base classes and functionality for writing and running functional tests with focus on testing REST endpoint. It provides help in setting up test database and loading fixtures and mocking services in DI (even private services).
Installation
Download the Bundle
Enable the Bundle
Symfony
Basic usage
Bootstrap for PHPUnit:
The assertions are done using snapshots for comparison.
By default the framework will look under Expected
directory (from where the test class is located)
for a file with the same name as the test and suffixed with -1.json
.
Example of expected output can be:
Expected/testReturns200AndUserData-1.json
The -1.json
suffix will be incremented for every REST assertion made under one test.
In the expected any functionality from coduo/php-matcher
can be used.
It is possible to automatically update content of expected files during test execution to the actual content by adding this extension to your phpunit config:
Fixtures are loaded using Doctrine fixtures.
By default the framework will look by default under Fixtures
directory (from where the test class is located)
for a PHP file with the same name as the test. This file must return an array of class names that extend
Speicher210\FunctionalTestBundle\Test\Loader\AbstractLoader
class.
Example of fixture file can be:
In order to rebuild and reset the database you need to create a bootstrap file for PHPUnit.
In your own bootstrap file you can include the file Test/bootstrap.php
which will reset the test database.
The database will not be rebuild for every test, but only once when the tests start.
This means that data must be removed before running next test. This can be achieved by running tests in a transaction.
For this add the extension to your phpunit config:
Accessing and mocking services
Mocking services can be achieved by using
Services can also be accessed by using
All versions of functional-test-bundle with dependencies
ext-json Version *
dama/doctrine-test-bundle Version ^6.0
doctrine/orm Version ^2.7
doctrine/data-fixtures Version ^1.4.1
doctrine/doctrine-fixtures-bundle Version ^3.1
phpunit/phpunit Version ^8.0|^9.0
coduo/php-matcher Version ^5.0 || ^6.0
symfony/browser-kit Version ^4.4 || ^5.1
symfony/css-selector Version ^4.4 || ^5.1
symfony/framework-bundle Version ^4.4 || ^5.1