Download the PHP package i22/functional-test-bundle without Composer
On this page you can find all versions of the php package i22/functional-test-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download i22/functional-test-bundle
More information about i22/functional-test-bundle
Files in i22/functional-test-bundle
Package functional-test-bundle
Short Description symfony bundle for optimised functional testing with alice and doctrine bundle
License proprietary
Informations about the package functional-test-bundle
i22 Functional Test Bundle
A Symfony bundle to simplify functional testing with the help of AliceBundle.
Table of contents:
- Installation
- Basic usage
- Seperate fixture files
- Authorize User
- Fake Translator
- Disabling Csrf Form Protection
Installation
-
Download the Bundle
-
Enable the Bundle
With Symfony 3.x adding the Bundle to
app/AppKernel.php
With Symfony 4.x adding the Bundle to
config/bundles.php
\ (Should be done with auto-configuration, but activated for all environments)
Basic usage
Loading fixtures for each test class
Instead of setting up the database with one big fixture file for all tests you can define seperate small fixture-sets customized for your test case.
Setup your Test Class to extend from WebTestCase
In order to load your customized fixtures automatically place a fixture folder with your fixtures beneath your test file
If you want do define from where to load your fixtures, you can override the method getFixtureFilePaths()
Authorize User
in case u need to authorize a user for your functional test, you can use the UserAuthorizationTrait to login the user.
the login method assumes that your firewall is named 'default'. in other cases use the second argument of the login method to specify how your firewall is named.
No Translator - working with translation keys
the bundle autoconfigures a FakeTranslator in test environment as the @default.translator service, so that instead of translating your translation keys, the translator will respond the original key.
for testing purpose it is usefull to test against the key instead of changing translations.
if you want to disable this feature, change the default configuration as follows:
Disabled auto csrf protection for forms
the bundle autoconfigures the symfony form with disabling the auto protection of forms instead of disabling the whole csrf protection services. so you are able to still use the csrf token manager to generate and use tokens for validation, but it simplifies the form post handling, because you dont need to add the _token value
if you want to disable this feature, change the default configuration as follows:
All versions of functional-test-bundle with dependencies
doctrine/data-fixtures Version ^1.3
hautelook/alice-bundle Version ^2.0
symfony/framework-bundle Version ^4.4
symfony/phpunit-bridge Version ^4.3