PHPackages                             lisincin/modera-foundation-testing-tools - 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. lisincin/modera-foundation-testing-tools

ActiveLibrary[Testing &amp; Quality](/categories/testing)

lisincin/modera-foundation-testing-tools
========================================

v1.0.x-dev(8y ago)025.4k1[1 PRs](https://github.com/LiSinCin/ModeraFoundationTestingTools/pulls)MITPHP

Since Dec 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/LiSinCin/ModeraFoundationTestingTools)[ Packagist](https://packagist.org/packages/lisincin/modera-foundation-testing-tools)[ RSS](/packages/lisincin-modera-foundation-testing-tools/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

LiSinCin Modera Foundation Testing Tools [![Build Status](https://camo.githubusercontent.com/25a9c7d5f6cf557f3c30f3267d889b2fe2e558c76300d85eca34a5b3efd28663/68747470733a2f2f7472617669732d63692e6f72672f4c6953696e43696e2f4d6f64657261466f756e646174696f6e54657374696e67546f6f6c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/LiSinCin/ModeraFoundationTestingTools)
=======================================================================================================================================================================================================================================================================================================================================================================================

[](#lisincin-modera-foundation-testing-tools-)

Adding few testing tools to [Modera\\FoundationBundle](https://github.com/modera/ModeraFoundationBundle).

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

[](#installation)

Add this dependency to your composer.json:

```
"modera/foundation-bundle": "dev-master",
"lisincin/modera-foundation-testing-tools": "~1.0"

```

Update your AppKernel class and add ModeraFoundationBundle declaration there:

```
new Modera\FoundationBundle\ModeraFoundationBundle(),

```

Documentation
-------------

[](#documentation)

### Functional testing

[](#functional-testing)

Modera\\FoundationBundle\\FunctionalTestCase allow you to increase speed of test writing by:

- kernel boot (this actual done by overriding and running static::createClient())
- entity manager creation,
- database create/delete/clear

#### Predefined variables

[](#predefined-variables)

- **$keepDatabase**. If true - test will reuse existing tables, if they are exists. Increase test rerun speed during development.
- **$useTransaction**. If true - all database activity will be wrapped inside transaction. Db clearing speed increasing. Good for the CI and single runs.
- **$client**. Predefined client.
- **$container**. Container of currently booted kernel.
- **$em**. Entity manager of current kernel.
- **$st**. Schema tool of current kernel.

Please, do not reboot(create new) kernel. This can lead to unexpected entity manager behavior.

#### Test case init

[](#test-case-init)

This test case introduce new test case init. All preparation(client creation, entity manager init, db preparing, transaction start) are done in *init* method. If you need to do something before that use *preInit* method. If you need to access some services or other symfony internals, init some components after symfony init override *postInit* method.

#### Test flow routines

[](#test-flow-routines)

##### Isolation

[](#isolation)

There is two isolation levels present. Method and Class. Override **getIsolationLevel()** to alter.

- **Class isolation level**. This means that database will be created/cleared and kernel will be booted only once. Before all tests. And every next test will works based on result of previous test. Usable if you want to reuse user auth, for example.
- **Method isolation level**. DB will be cleared and kernel will be booted before every test.

##### Tables creation

[](#tables-creation)

Most functional test sooner or later will start using databases. FunctionalTestCase allow you to simplify this procedure.

override **getDatabaseTableList** method. This method should return array of used entities ClassMetadata.

##### Tables reuse

[](#tables-reuse)

To keep and reuse database tables override

```
static $keepDatabase = true;

```

##### Use transaction instead tables clearing

[](#use-transaction-instead-tables-clearing)

```
static $useTransaction = true;

```

##### Many to many entities clearing

[](#many-to-many-entities-clearing)

In case of many to many connection simple one by one tables delete can lead to foreign key errors. To avoid this situation use **preClear** method to resolve(delete) this entities.

##### Simple test case example

[](#simple-test-case-example)

```
class SimpleTestCase extends FunctionalTestCase
{
    /**
     * @var SimpleService
     */
    static private $simpleService

    static public function postInit()
    {
       static::$simpleService = static::$container->get('simple.service');
    }

    static protected function getDatabaseTableList()
    {
       return [
           static::$em->getClassMetadata('\Acme\AppBundle\Entity\SimpleEntity');
       ]
    }

    function testSimpleTestCase()
    {
         // do some test stuff here
    }
}

```

#### Basic phpunit method override

[](#basic-phpunit-method-override)

List of method overrides.

- setUpBeforeClass. Override **doSetUpBeforeClass** template method to use setUpBeforeClass.
- tearDownAfterClass. Override **doTearDownAfterClass**
- setUp. Override **doSetUp**
- tearDown. Override **doTearDown**

Licensing
---------

[](#licensing)

This bundle is under the MIT license. See the complete license in the bundle: Resources/meta/LICENSE

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3120d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3533c83f8e223b3c80a7f02c0636b73570da4de16673156d9eab447bc13f9ab4?d=identicon)[Alex Plaksin](/maintainers/Alex%20Plaksin)

---

Top Contributors

[![LiSinCin](https://avatars.githubusercontent.com/u/6211954?v=4)](https://github.com/LiSinCin "LiSinCin (13 commits)")[![cravler](https://avatars.githubusercontent.com/u/157440?v=4)](https://github.com/cravler "cravler (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lisincin-modera-foundation-testing-tools/health.svg)

```
[![Health](https://phpackages.com/badges/lisincin-modera-foundation-testing-tools/health.svg)](https://phpackages.com/packages/lisincin-modera-foundation-testing-tools)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[kimai/kimai

Kimai - Time Tracking

4.8k8.7k1](/packages/kimai-kimai)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k56](/packages/open-dxp-opendxp)

PHPackages © 2026

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