PHPackages                             heimrichhannot/contao-test-utilities-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. heimrichhannot/contao-test-utilities-bundle

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

heimrichhannot/contao-test-utilities-bundle
===========================================

A bundle containing utilities for easier contao bundle testing.

0.1.8(6mo ago)035.6k↓66.7%7LGPL-3.0-or-laterPHPPHP ^8.1CI passing

Since May 16Pushed 6mo ago6 watchersCompare

[ Source](https://github.com/heimrichhannot/contao-test-utilities-bundle)[ Packagist](https://packagist.org/packages/heimrichhannot/contao-test-utilities-bundle)[ RSS](/packages/heimrichhannot-contao-test-utilities-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (10)Versions (10)Used By (7)

Contao Test Utilities Bundle
============================

[](#contao-test-utilities-bundle)

[![](https://camo.githubusercontent.com/2b1732baa25914ee5ccbeaf42980d671de29700b49e0639e1edc8e66181f6905/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/2b1732baa25914ee5ccbeaf42980d671de29700b49e0639e1edc8e66181f6905/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c25323031302d627269676874677265656e2e7376673f7374796c653d666c6174)

This bundle helps with recurring tasks when testing bundles for contao cms.

Install
-------

[](#install)

```
composer require --dev heimrichhannot/contao-test-utilities-bundle

```

Content
-------

[](#content)

### Mocking objects

[](#mocking-objects)

This bundle provide some traits to mock following contao types:

- models
- templates

```
class Test {
    use \HeimrichHannot\TestUtilitiesBundle\Mock\ModelMockTrait;
    use \HeimrichHannot\TestUtilitiesBundle\Mock\TemplateMockTrait;

    public function testMockTemplate() {
        $templateMock = $this->mockTemplateObject(\Contao\FrontendTemplate::class, 'ce_test');
        $templateMock->setName('ce_skip');
        $templateMock->getName();
        $templateMock->setData(['foo' => 'bar']);
        $templateMock->getData();
        // and __get, __set, __isset
    }

    public function testModelMock() {
        $model = $this->mockModelObject(\Contao\PageModel::class, []);
        $model->row();
        // and __get, __set, __isset
    }
}
```

### Singletons

[](#singletons)

#### Reset Files singleton

[](#reset-files-singleton)

It is recommend to always reset the Files (singleton) class when testing code interacting with it, as it can store data from past tests (for example the container). So you don't need to run a test method in another process.

```
\HeimrichHannot\TestUtilitiesBundle\Singleton\ResetFilesSingletonTrait::resetFileSingletonInstance()
```

`\Contao\Files:.getInstance()` will return a fresh instance.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance66

Regular maintenance activity

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Every ~300 days

Recently: every ~357 days

Total

9

Last Release

204d ago

PHP version history (3 changes)0.1.0PHP ^7.1

0.1.5PHP ^7.1 || ^8.0

0.1.8PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/28ad3224d8727b622ebd229840eea6b9dbcb83eb0bd609e6ce65b614830ff538?d=identicon)[digitales@heimrich-hannot.de](/maintainers/digitales@heimrich-hannot.de)

---

Top Contributors

[![koertho](https://avatars.githubusercontent.com/u/12064642?v=4)](https://github.com/koertho "koertho (20 commits)")

###  Code Quality

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/heimrichhannot-contao-test-utilities-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/heimrichhannot-contao-test-utilities-bundle/health.svg)](https://phpackages.com/packages/heimrichhannot-contao-test-utilities-bundle)
```

PHPackages © 2026

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