PHPackages                             becklyn/test-helpers - 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. becklyn/test-helpers

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

becklyn/test-helpers
====================

Common test helpers

1.3.0(4y ago)11.2kBSD-3-ClausePHPPHP &gt;=7.4

Since Nov 25Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Becklyn/test-helpers)[ Packagist](https://packagist.org/packages/becklyn/test-helpers)[ Docs](https://github.com/Becklyn/test-helpers)[ RSS](/packages/becklyn-test-helpers/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (6)Dependencies (7)Versions (7)Used By (0)

Test Helpers
============

[](#test-helpers)

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

[](#installation)

```
composer require --dev becklyn/test-helpers
```

Usage
-----

[](#usage)

The bundle contains various base tests, that can be used in bundles / libraries.

### Schema Validation Test

[](#schema-validation-test)

This test receives a list of directories and tests that there are no mapping errors in doctrine annotations.

#### Usage

[](#usage-1)

Extend it in your `tests` directory:

`tests/ValidateEntitySchemaTest`:

```
use Becklyn\TestHelpers\Doctrine\SchemaValidationTest;

class ValidateEntitySchemaTest extends SchemaValidationTest
{
}
```

There are two extension points:

- `getRootDir(): string` must return the absolute path to the root of your app. By default it assumes that your test is directly in the tests directory top level. Change it, if that isn't the case.
- `getEntityDirs(): string[]` must return the list of absolute paths, where files with mapping info are stored. By default set to `getRootDir()/src/Entity`.

### No Missing Translations Test

[](#no-missing-translations-test)

This tests checks that there are no translations used that are missing in the library.

> You need to install the package `becklyn/translations-extractor`, preferably via the `composer-bin-plugin`:
>
> ```
> composer bin test require becklyn/translations-extractor
> ```

Translations will be extracted from:

- Validation constraint annotations in entities (on the class itself and its properties)
- Form field options in `AbstractType`s
- Usages of the `BackendTranslator` (Mayd-specific)
- Usages of `ExecutionContext(Interface)` in `@Callback` methods
- Symfony: `$this->get('translator')->trans('foobar')` in controllers
- Symfony: `$this->get('translator')->transChoice('foobar')` in controllers
- Symfony: `$this->addFlash()` and `$this->getFlashBag()->add()` in controllers
- Symfony: Form type choices
- Defaults messages from custom validation constraint message properties
- Specific constructor parameters of special classes

#### Usage

[](#usage-2)

Extend it in your `tests` directory:

`tests/ValidateEntitySchemaTest`:

```
use Becklyn\PhpCs\Testing\NoMissingTranslationsTest;

class ValidateTranslationsTest extends NoMissingTranslationsTest
{
}
```

There are several extension points:

- `getLocales(): string[]` returns the list of locales to validate. By default set to `["de", "en"]`.
- `getDirectoriesWithUsages(): string[]` returns the absolute paths to where there is code that is using translations (like forms, entities, templates, etc..). By default set to `["getRootDir()/src"]`.
- `getDirectoriesWithTranslations(): string[]`: returns the absolute paths to where the translations are stored. The translations files are expected to be in the `yaml` format. By default set to `["getRootDir()/src/Resources/translations"]`.
- `getIgnoredKeys[]: (complex)`: returns the list of keys that should be ignored when validating for missing keys. See below for details. By default set to `[]`.
- `getRootDir(): string[]`: must return the absolute path to the root of your app. By default it assumes that your test is directly in the tests directory top level. Change it, if that isn't the case.
- `getMockedFunctions(): string[]`: the names of the twig functions that are defined by this project / library. They need to be mocked, as otherwise Twig will throw exceptions.
- `getMockedFilters(): string[]`: the names of the twig filters that are defined by this project / library. They need to be mocked, as otherwise Twig will throw exceptions.
- `getMockedTests(): string[]`: the names of the twig tests that are defined by this project / library. They need to be mocked, as otherwise Twig will throw exceptions.

##### Defining Ignored Keys

[](#defining-ignored-keys)

The ignored keys are an indexed array, where

- *the key* is a valid RegEx pattern. \*Be sure to make it as specific as possible (e.g. by using `^` and `$`).
- *the value* is the list of domains (`string[]`) where this ignore should apply. Instead of an array you can pass `true` to ignore it in any domain.

```
return [
    "~^example\\..*$~" => ["form", "validators"], // ignore example.* in "form" and "validators" domain only
                                                  // (i.e. will still be reported for "messages" for example)

    "~^second\\..*$~" => true,                    // ignore second.* in every domain
];
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Recently: every ~203 days

Total

7

Last Release

1551d ago

PHP version history (2 changes)1.0.0PHP ^7.2

1.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1044355?v=4)[Becklyn Studios](/maintainers/becklyn)[@Becklyn](https://github.com/Becklyn)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/becklyn-test-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/becklyn-test-helpers/health.svg)](https://phpackages.com/packages/becklyn-test-helpers)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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