kununu / testing-bundle
Testing made easy by providing helper classes and fixtures loading
Installs: 39 469
Dependents: 0
Suggesters: 1
Security: 0
Stars: 8
Watchers: 12
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.3
- ext-filter: *
- kununu/collections: ^6.4
- kununu/data-fixtures: ^13.0
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-kernel: ^6.4
Requires (Dev)
- ext-json: *
- ext-pdo: *
- doctrine/dbal: ^3.8
- doctrine/doctrine-bundle: ~2.15.0
- doctrine/doctrine-migrations-bundle: ^3.3
- doctrine/orm: ^3.0
- elasticsearch/elasticsearch: ^7.10
- kununu/scripts: >=6.1
- matthiasnoback/symfony-dependency-injection-test: ^6.1
- nyholm/psr7: ^1.8
- opensearch-project/opensearch-php: ^2.0
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^12.3
- psr/cache: ^2.0
- rector/rector: ^2.0
- shipmonk/composer-dependency-analyser: ^1.8
- symfony/browser-kit: ^6.4
- symfony/dotenv: ^6.4
- symfony/http-client: ^6.4
- symfony/http-foundation: ^6.4
Suggests
- ext-pdo_mysql: To run Integration Tests.
- doctrine/doctrine-bundle: To run Integration Tests.
- elasticsearch/elasticsearch: To run Integration Tests.
- opensearch-project/opensearch-php: To run Integration Tests.
- psr/cache: To run Integration Tests.
- symfony/http-client: To run Integration Tests.
- symfony/http-foundation: To run Integration Tests.
- dev-main
- v21.0.0
- v20.3.0
- v20.2.0
- v20.1.0
- v20.0.0
- v19.0.0
- v18.0.0
- v17.4.1
- v17.4.0
- v17.3.0
- v17.2.0
- v17.1.0
- v17.0.0
- v16.1.0
- v16.0.1
- v16.0.0
- v15.0.0
- v14.0.2
- v14.0.1
- v14.0.0
- v13.0.1
- v13.0.0
- 12.0.0
- v11.0.0
- v10.0.0
- v9.0.0
- 8.0.2
- 8.0.1
- 8.0.0
- 7.0.1
- v7.0.0
- v6.0.0
- v5.0.0
- 4.0.0
- 3.0.0
- 2.1.0
- 2.0.0
- 1.0.0
- dev-dependabot/composer/doctrine/doctrine-bundle-approx-2.16.1
- dev-dependabot/github_actions/dot-github/workflows/SonarSource/sonarqube-scan-action-5.3.1
This package is auto-updated.
Last update: 2025-09-06 06:02:06 UTC
README
This bundle integrates with kununu/data-fixtures package allowing you to load fixtures in your tests.
It also provides some utilities that makes testing easier, like a RequestBuilder
that turns testing controllers more expressive.
If you want to see an example of what this bundle can do for you click here.
Install
1. Add kununu/testing-bundle to your project
Please be aware that this bundle should not be used in production mode!
composer require --dev kununu/testing-bundle
2. Enable Bundle
Enable the bundle at config/bundles.php
for any environment.
<?php declare(strict_types=1); return [ ... Kununu\TestingBundle\KununuTestingBundle::class => ['dev' => true, 'test' => true], ];
Configuration
Create the file kununu_testing.yaml
inside config/packages/test/
.
The configuration options of the bundle heavily depend on the fixture type.
Check out the Load Fixtures section where you can find more options.
Tip
If you are using the bundle on more than one environment, for example dev and test, and the configuration options are exactly the same you can import the kununu_testing.yaml
like bellow in order to not duplicate the configurations.
# config/packages/dev/kununu_testing.yaml kununu_testing: cache: pools: app.cache.first: load_command_fixtures_classes_namespace: - 'Kununu\TestingBundle\Tests\App\Fixtures\CachePool\CachePoolFixture1'
# config/packages/test/kununu_testing.yaml imports: - { resource: '../dev/kununu_testing.yaml' }
Load Fixtures
This bundle integrates with kununu/data-fixtures allowing you to load fixtures in your tests.
Currently, this bundle supports the following types of fixtures:
- Doctrine DBAL Connection Fixtures
- Cache Pool Fixtures
- Elasticsearch Fixtures
- OpenSearch Fixtures
- Symfony Http Client Fixtures
Schema Copier
This bundle also has a way of copying a database schema from one database to another.
See more:
Testing your code
To test your code, load fixtures and call your endpoints, see:
Testing the bundle
This repository takes advantages of GitHub actions to run tests when a commit is performed to a branch.
If you want to run the integration tests on your local machine you will need:
- pdo_mysql extension
- MySQL server
- Elasticsearch cluster
- OpenSearch cluster
In your local environment to get everything ready for you, run ./tests/setupLocalTests.sh
and follow the instructions.
Then you can run the tests: vendor/bin/phpunit
.
Contribute
If you are interested in contributing read our contributing guidelines.