PHPackages                             nerds-and-company/craft-unit-test-suite - 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. nerds-and-company/craft-unit-test-suite

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

nerds-and-company/craft-unit-test-suite
=======================================

A library that helps you mocking Craft database/model classes

1.0.1(10y ago)25.4k1MITPHPPHP &gt;= 5.3

Since Nov 25Pushed 10y ago3 watchersCompare

[ Source](https://github.com/nerds-and-company/craft-unit-test-suite)[ Packagist](https://packagist.org/packages/nerds-and-company/craft-unit-test-suite)[ RSS](/packages/nerds-and-company-craft-unit-test-suite/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Unit Test Suite
===============

[](#unit-test-suite)

PHPUnit test suit helps you with mocking several craft services and classes.

It enable you to:

- Configure any abstract classes you wish to load before running unit tests
- Save time by not having to manually mock Craft's database models and it's required classes
- Simply override or add extra methods to the mocked classes mocked in UnitTestSuite\_AbstractTest

Requirements:
-------------

[](#requirements)

- PHP 5.4+
- Craft 2.4+

Installation:
-------------

[](#installation)

The library can be installed using Composer.

```
composer require nerds-and-company/unit-test-suite ~1.0.0

```

Classes:
--------

[](#classes)

The library is composed of two classes:

- `UnitTestSuite_AbstractTest` is the abstract class you can extend that contains the mocked Craft database classes
- `AbstractTestLoader` is used to load custom abstract classes that for example extend UnitTestSuite\_AbstractTest and add extra functionality

Usage
-----

[](#usage)

- Make sure the phpunit bootstrap points at `bootstrap="vendor/unittestsuite/src/bootstrap.php`
- Copy the `unittestsuite.yml` supplied with this package `/craft/config` and add extra (abstract) classes you wish to pre-load
- Extend `UnitTestSuite_AbstractTest` and override or add extra data to the returned mocks
- Calling $this-&gt;mockCraftDb() should cover most of the Craft DB methods

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

3821d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/473941cfd5dd7f9070a5ee2e0c7fe71ef6f9aed74e40cee91cebf77a2392bb27?d=identicon)[nerds-and-company](/maintainers/nerds-and-company)

---

Tags

phpunitdatabasemodelCraftDBCommand

### Embed Badge

![Health badge](/badges/nerds-and-company-craft-unit-test-suite/health.svg)

```
[![Health](https://phpackages.com/badges/nerds-and-company-craft-unit-test-suite/health.svg)](https://phpackages.com/packages/nerds-and-company-craft-unit-test-suite)
```

###  Alternatives

[code-distortion/adapt

A Laravel package that builds databases for your tests, improving their speed.

2835.5k](/packages/code-distortion-adapt)[aik099/phpunit-mink

Library for using Mink in PHPUnit tests. Supports session sharing between tests in a test case.

72136.2k1](/packages/aik099-phpunit-mink)[erikgall/eloquent-phpunit

Test Eloquent models, database schemas &amp; tables, relationships/foreign keys using PHPUnit.

2016.5k](/packages/erikgall-eloquent-phpunit)[ockcyp/covers-validator

Validates @covers tags in PHPUnit tests

21198.0k82](/packages/ockcyp-covers-validator)

PHPackages © 2026

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