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.

1181PHPCI passing

Since May 9Pushed 2mo 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 3w ago

READMEChangelogDependenciesVersions (2)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 25% of packages

Maintenance56

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity14

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)
```

PHPackages © 2026

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