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(5mo ago)034.8k↓50%7LGPL-3.0-or-laterPHPPHP ^8.1CI passing

Since May 16Pushed 5mo 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 1mo ago

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

47

—

FairBetter than 94% of packages

Maintenance72

Regular maintenance activity

Popularity25

Limited adoption so far

Community16

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

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

###  Alternatives

[terminal42/contao-node

Node bundle for Contao Open Source CMS

3172.5k4](/packages/terminal42-contao-node)[contao-community-alliance/dc-general

Universal data container for Contao

1578.3k86](/packages/contao-community-alliance-dc-general)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.5k](/packages/numero2-contao-storelocator)

PHPackages © 2026

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