endroid / bundle-test
Endroid Bundle Test
Requires
- php: >=7.1
- ext-iconv: *
- behat/mink-extension: ^2.3
- behat/mink-goutte-driver: ^1.2
- behat/mink-selenium2-driver: ^1.3
- behat/symfony2-extension: ^2.1
- doctrine/data-fixtures: ^1.3
- doctrine/doctrine-bundle: ^1.8.1
- doctrine/doctrine-fixtures-bundle: ^2.4.1|^3.0
- doctrine/orm: ^2.6.3
- endroid/test: dev-master
- guzzlehttp/guzzle: ^6.3
- sensio/framework-extra-bundle: ^5.1
- symfony/browser-kit: ^3.4|^4.0
- symfony/console: ^3.4|^4.0
- symfony/dotenv: ^3.4|^4.0
- symfony/framework-bundle: ^3.4|^4.0
- symfony/monolog-bridge: ^3.4|^4.0
- symfony/monolog-bundle: ^3.2
- symfony/phpunit-bridge: ^3.4.18|^4.0
- symfony/twig-bundle: ^3.4|^4.0
- symfony/var-dumper: ^3.4|^4.0
- symfony/web-server-bundle: ^3.4|^4.0
- symfony/yaml: ^3.4|^4.0
Requires (Dev)
- symfony/flex: ^1.0
This package is auto-updated.
Last update: 2023-11-07 13:17:50 UTC
README
By endroid
Allows easy testing of bundle functionality like routes and services by providing a testing kernel and configuration and allowing to define additional configuration inside your bundle without the need for creating a custom kernel.
Installation
Use Composer to install the library.
$ composer require endroid/bundle-test --dev
Configuration
You can place your package, routing and bundle configuration in the tests/config folder like you would normally in a Symfony 3.4+ application. The library already contains some default libraries like the framework bundle, twig bundle, monolog etc. so you only need to include things that are necessary for your bundle.
Usage
Create a BundleTestCase to test your bundle like you would normally create a WebTestCase inside your application. The BundleTestCase automatically creates a kernel and loads the configuration from your tests/config directory.
<?php use Endroid\BundleTest\BundleTestCase; class HomeControllerTest extends BundleTestCase { public function testInvoke() { $client = static::createClient(); $client->request('GET', '/'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals('Home', $client->getCrawler()->filter('h1')->text()); } }
And run simple-phpunit to execute your tests.
$ vendor/bin/simple-phpunit
Versioning
Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.
License
This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.