PHPackages                             dereuromark/cakephp-test-helper - 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. dereuromark/cakephp-test-helper

ActiveCakephp-plugin[Testing &amp; Quality](/categories/testing)

dereuromark/cakephp-test-helper
===============================

A CakePHP plugin for generating test cases and debugging tests with standalone UI

2.8.2(3mo ago)634.8k—0%2[1 issues](https://github.com/dereuromark/cakephp-test-helper/issues)1MITPHPPHP &gt;=8.2CI passing

Since Apr 25Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/dereuromark/cakephp-test-helper)[ Packagist](https://packagist.org/packages/dereuromark/cakephp-test-helper)[ Docs](https://github.com/dereuromark/cakephp-test-helper)[ RSS](/packages/dereuromark-cakephp-test-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (31)Used By (1)

CakePHP TestHelper plugin
=========================

[](#cakephp-testhelper-plugin)

[![CI](https://github.com/dereuromark/cakephp-test-helper/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/dereuromark/cakephp-test-helper/actions/workflows/ci.yml?query=branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/273652c678b6781b001acbc5a29d838e59ed9623163f578a84fef7738b4144d3/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6465726575726f6d61726b2f63616b657068702d746573742d68656c7065722f6d61737465722e737667)](https://codecov.io/github/dereuromark/cakephp-test-helper/branch/master)[![PHPStan](https://camo.githubusercontent.com/f60d96f7c2579690ab6dfa8918f777fe93a02a92301c661eb38a85861a92b780/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c6174)](https://phpstan.org/)[![Latest Stable Version](https://camo.githubusercontent.com/cb23c86d2240a222f0cda08edb8e0b63d0ba8560c4bd2358a23b9a61362db280/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d746573742d68656c7065722f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/cakephp-test-helper)[![Minimum PHP Version](https://camo.githubusercontent.com/ec21f169d70b69344c67d6f18fa1a24d20476d2f0cd680e8c4a1534c22f34e5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/745684181c10bbedbab9a14ad7ff462a2ae6cfc9aaf8ed8de458b4d16cea29d6/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d746573742d68656c7065722f6c6963656e73652e737667)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/2009c2c221d52a4c923d92a122eedd38889da9c9389747b787127df521e0fdb7/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d746573742d68656c7065722f642f746f74616c)](https://packagist.org/packages/dereuromark/cakephp-test-helper)[![Coding Standards](https://camo.githubusercontent.com/dbabe22710e675cb88cd0b12196f1477e2376dea497332775692cf1359a75918/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d5053522d2d322d2d522d79656c6c6f772e737667)](https://github.com/php-fig-rectified/fig-rectified-standards)

Browser based addons for your test driven development.

Note: This branch is for **CakePHP 5.1+**. See [version map](https://github.com/dereuromark/cakephp-test-helper/wiki#cakephp-version-map) for details.

Motivation
----------

[](#motivation)

After 2.x=&gt;3.x, the "web-tester" has been removed. It was, for certain cases, however, quite useful. This aims to bring back a part of it.

The CLI also doesn't allow a good overview. Even with auto-complete, you have to type almost everything out. With a browser backend generating tests or running them is just a simple mouse click.

You have an overview of your classes and the test classes to it. If there is one missing, you can easily "bake" it from this web backend. It internally uses [Bake](https://github.com/cakephp/bake/) plugin as well as your preferred theme.

### Further useful addons

[](#further-useful-addons)

- **SQL to Query Builder Converter** - Convert raw SQL to CakePHP Query Builder code with full features
- URL array generation from string URLs (respects routing, so it is basically also a reverse lookup)
- Fixture validation tool (compares actual DB with the schema files: fields and attributes, constraints and indexes)
- Model/entity/table comparison overview.
- GUI for fixture comparison and generation of missing ones per mouse click.
- Custom linter tasks for project-specific code quality checks.

[![Dashboard](docs/img/dashboard.png)](docs/img/dashboard.png)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org):

```
composer require --dev dereuromark/cakephp-test-helper

```

Note: This is not meant for production, so make sure you use the `--dev` flag and install it as development-only tool.

Setup
-----

[](#setup)

Load the plugin:

```
bin/cake plugin load TestHelper --only-debug

```

This will also load the routes.

### Authorization Plugin

[](#authorization-plugin)

If you are using the [CakePHP Authorization plugin](https://github.com/cakephp/authorization), you need to configure TestHelper to bypass authorization checks. Add this to your `config/bootstrap.php`:

```
Configure::write('TestHelper.ignoreAuthorization', true);
```

This is similar to how DebugKit handles authorization and is necessary to prevent `AuthorizationRequiredException` errors when accessing TestHelper routes.

### non-dev mode

[](#non-dev-mode)

In certain apps it can be useful to have some of the helper functionality available also for staging and prod. Here you must make sure then to not load the routes, though:

```
$this->addPlugin('TestHelper', ['routes' => Configure::read('debug')]);
```

And here you must use `composer require` without `--dev` flag then.

Usage
-----

[](#usage)

Navigate to `/test-helper` backend and select the app or plugin you want to check. You can then with a single click

- check what classes do not yet have a test case
- generate a test case for them (or copy and paste a generated code into CLI)
- run test case
- check coverage on a tested class, as overall and in detail

Supported class types:

- Controllers
- Models (Tables/Entities)
- Components
- Behavior
- Helpers
- Commands
- Tasks
- Cells
- CommandHelpers
- Forms
- Mailers

[Full Documentation](docs/README.md)

Custom Linter Tasks
-------------------

[](#custom-linter-tasks)

The plugin includes a flexible linter system for running project-specific code quality checks.

```
bin/cake linter
```

See [Linter Documentation](docs/Linter.md) for details on creating custom tasks, configuration, and included default tasks.

SQL to Query Builder Converter
------------------------------

[](#sql-to-query-builder-converter)

Convert raw SQL queries to CakePHP Query Builder code with just a click! Navigate to `/test-helper/query-builder` to access this powerful tool.

**Features:**

- ✅ **Comprehensive SQL Support**: SELECT, INSERT, UPDATE, DELETE with complex conditions
- ✅ **String Functions**: CONCAT, SUBSTRING, TRIM, UPPER, LOWER, COALESCE
- ✅ **Date Functions**: NOW, YEAR, MONTH, DATEDIFF, DATE\_FORMAT
- ✅ **Advanced Features**: CASE expressions, subqueries, window functions, CTEs
- ✅ **JOINs**: INNER, LEFT, RIGHT with complex ON conditions
- ✅ **Syntax Highlighting**: Prism.js for SQL and PHP code
- ✅ **Production Ready**: Generates clean, idiomatic CakePHP code

**Example:**

```
SELECT CONCAT(first_name, ' ', last_name) AS full_name,
       COUNT(posts.id) AS post_count
FROM users
LEFT JOIN posts ON posts.user_id = users.id
WHERE users.active = 1
GROUP BY users.id
HAVING COUNT(posts.id) > 5
```

Instantly converts to:

```
$query = $this->find()
    ->select(function ($query) {
        return [
            'full_name' => $query->func()->concat(['first_name', "' '", 'last_name']),
            'post_count' => $query->func()->count('posts.id')
        ];
    })
    ->leftJoin(['Posts' => 'posts'], 'posts.user_id = users.id')
    ->where(['users.active' => 1])
    ->groupBy(['users.id'])
    ->having(['COUNT(posts.id) >' => 5]);
```

See [SQL Converter Documentation](docs/SqlConverter.md) for complete guide and examples.

Limitations
-----------

[](#limitations)

Executing the tests and coverage from the web backend usually can not work for long-running tests due to the timeout issues. Make sure you raise the apache/nginx settings here if you want to use this functionality here.

The focus is on providing an overview and quickly generating the desired classes with a single mouse click.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance81

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 98.3% 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 ~105 days

Recently: every ~20 days

Total

28

Last Release

100d ago

Major Versions

0.2.3 → 1.0.0-beta2019-12-27

0.2.4 → 1.1.02020-11-12

1.1.2 → 2.0.0-RC2023-10-17

PHP version history (5 changes)0.1.0PHP &gt;=5.6.0

1.0.0-betaPHP &gt;=7.2

1.1.2PHP &gt;=7.4

2.0.0-RCPHP &gt;=8.1

2.8.1PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39854?v=4)[Mark Scherer](/maintainers/dereuromark)[@dereuromark](https://github.com/dereuromark)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (285 commits)")[![highstrike](https://avatars.githubusercontent.com/u/2379538?v=4)](https://github.com/highstrike "highstrike (5 commits)")

---

Tags

plugindevcoveragecakephptestsgeneratesetup

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dereuromark-cakephp-test-helper/health.svg)

```
[![Health](https://phpackages.com/badges/dereuromark-cakephp-test-helper/health.svg)](https://phpackages.com/packages/dereuromark-cakephp-test-helper)
```

###  Alternatives

[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

598161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[leanphp/behat-code-coverage

Generate Code Coverage reports for Behat tests

50359.8k2](/packages/leanphp-behat-code-coverage)[cakephp/bake

Bake plugin for CakePHP

11211.2M158](/packages/cakephp-bake)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

593.6M37](/packages/dvdoug-behat-code-coverage)[vierge-noire/cakephp-fixture-factories

CakePHP Dynamic Fixtures

84858.8k9](/packages/vierge-noire-cakephp-fixture-factories)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

36162.8k2](/packages/dereuromark-cakephp-setup)

PHPackages © 2026

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