Endroid Bundle Test

dev-master / 1.x-dev 2019-10-07 19:40 UTC

This package is auto-updated.

Last update: 2019-12-07 20:25:42 UTC


By endroid

Latest Stable Version Build Status Total Downloads Total Downloads License

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.


Use Composer to install the library.

$ composer require endroid/bundle-test --dev


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.


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.


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


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.


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.