PHPackages                             kuzman/doctrine-elastica-test-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. kuzman/doctrine-elastica-test-bundle

ActiveSymfony-bundle[Testing &amp; Quality](/categories/testing)

kuzman/doctrine-elastica-test-bundle
====================================

PHPUnit rollback support for Elasticsearch writes performed through FOSElasticaBundle.

191PHPCI passing

Since May 9Pushed 1mo agoCompare

[ Source](https://github.com/igor-kuzmanovic/doctrine-elastica-test-bundle)[ Packagist](https://packagist.org/packages/kuzman/doctrine-elastica-test-bundle)[ RSS](/packages/kuzman-doctrine-elastica-test-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

DoctrineElasticaTestBundle
==========================

[](#doctrineelasticatestbundle)

[![Continuous integration](https://github.com/igor-kuzmanovic/doctrine-elastica-test-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/igor-kuzmanovic/doctrine-elastica-test-bundle/actions/workflows/ci.yml)

DoctrineElasticaTestBundle rolls back Elasticsearch changes made through FOSElastica persisters between PHPUnit tests.

Heavily inspired by .

🚨 EXPERIMENTAL
--------------

[](#-experimental)

- This bundle is experimental and may change without notice.
- Currently works only with the FOSElasticaBundle fork at .

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 6.4, 7.3, or 8.0
- FOSElasticaBundle 7.x

Installation
------------

[](#installation)

```
composer require --dev kuzman/doctrine-elastica-test-bundle
```

Register the bundle for the test environment in `config/bundles.php`:

```
return [
    // ...
    Kuzman\DoctrineElasticaTestBundle\KuzmanDoctrineElasticaTestBundle::class => ['test' => true],
];
```

Add the PHPUnit extension to `phpunit.xml.dist`:

```

```

Usage
-----

[](#usage)

Once installed, the bundle activates automatically when your PHPUnit suite loads the extension.

### Skipping rollback for specific tests

[](#skipping-rollback-for-specific-tests)

Use `Kuzman\DoctrineElasticaTestBundle\PHPUnit\SkipElasticsearchRollback` when you need to bypass rollback handling for a specific test class or method.

```
use Kuzman\DoctrineElasticaTestBundle\PHPUnit\SkipElasticsearchRollback;

#[SkipElasticsearchRollback] // skip for all tests in this class
final class MyTest extends \PHPUnit\Framework\TestCase
{
}

final class AnotherTest extends \PHPUnit\Framework\TestCase
{
    #[SkipElasticsearchRollback] // skip only this test method
    public function testSomething(): void
    {
    }
}
```

Caveats
-------

[](#caveats)

- Only writes that go through FOSElastica persisters are tracked.
- Out-of-band Elasticsearch writes are not rolled back.
- Rollback works only when tests are executed by PHPUnit with this extension enabled in phpunit.xml.dist.

Development
-----------

[](#development)

```
vendor/bin/php-cs-fixer fix --dry-run --diff
vendor/bin/phpstan analyse
vendor/bin/phpunit
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance61

Regular maintenance activity

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc18b8e42dd7af0cca363c21dccca3dad10064595af37fad6bf675aa7e092ab1?d=identicon)[igor-kuzmanovic](/maintainers/igor-kuzmanovic)

---

Top Contributors

[![igor-kuzmanovic](https://avatars.githubusercontent.com/u/27064619?v=4)](https://github.com/igor-kuzmanovic "igor-kuzmanovic (4 commits)")[![igorcraftec](https://avatars.githubusercontent.com/u/281586680?v=4)](https://github.com/igorcraftec "igorcraftec (1 commits)")

### Embed Badge

![Health badge](/badges/kuzman-doctrine-elastica-test-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/kuzman-doctrine-elastica-test-bundle/health.svg)](https://phpackages.com/packages/kuzman-doctrine-elastica-test-bundle)
```

###  Alternatives

[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3309.4M1.2k](/packages/szepeviktor-phpstan-wordpress)[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M340](/packages/dms-phpunit-arraysubset-asserts)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3524.1M38](/packages/jasonmccreary-laravel-test-assertions)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8219.1M67](/packages/orchestra-workbench)[soyuka/contexts

Behatch contexts

282.2M21](/packages/soyuka-contexts)[roquie/laravel-dusk-select2

Select2.js support for the Laravel Dusk testing.

41356.2k5](/packages/roquie-laravel-dusk-select2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
