PHPackages                             monomelodies/gentry - 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. monomelodies/gentry

Abandoned → [gentry/gentry](/?search=gentry%2Fgentry)Library[Testing &amp; Quality](/categories/testing)

monomelodies/gentry
===================

PHP unit test generation tools

0.9.0(10y ago)02456MITPHPPHP &gt;=7

Since Jun 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/monomelodies/gentry)[ Packagist](https://packagist.org/packages/monomelodies/gentry)[ RSS](/packages/monomelodies-gentry/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (48)Used By (6)

Gentry
======

[](#gentry)

A testing framework for PHP7+

Good programmers are lazy, but unfortunately that means that stuff like writing tests (boooooring) is often skipped. Please don't; it's important and oh so handy once you have them in place.

Gentry was designed with three goals in mind:

1. To make writing tests *so* easy even the worst slacker will bother;
2. To alleviate writing boilerplate code by generating skeletons for you.
3. Speed. You want to run tests before you push, so if they're slow that's *annoying*.

Prerequisites
-------------

[](#prerequisites)

- Make sure you have PHP7. Seriously, Gentry uses some new features so it'll fail miserably on anything older.
- Turn on assertions and configure them to throw `AssertionError` on failure. See [this section in the manual](http://php.net/manual/en/function.assert.php); both values should be set to `1`.

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

[](#installation)

### Composer (recommended)

[](#composer-recommended)

```
composer require --dev monomelodies/gentry
```

You can now run `vendor/bin/gentry`.

### Manual

[](#manual)

Download or clone the repo. There's an executable in the root.

Configuration
-------------

[](#configuration)

Create a `Gentry.json` file in the root of your project. It uses the following options:

```
{
    "src": "/path/to/src",
    "tests": "/path/to/tests",
    "bootstrap": "/path/to/bootstrap.php",
    "namespace": "Foo",
    "ignore": "some.*?regex"
}
```

### string|array `src`

[](#stringarray-src)

### string `tests`

[](#string-tests)

Both `src` and `tests` can be either absolute, or relative to the root - hence `"/path/to/root/src"` could be simplified to just `"src"`.

Directories are recursed. If Gentry detects that `tests` is inside `src`, it skips it for you (but seriously, don't do that).

Gentry supports multiple `src` directories, but only one `tests` directory. The simple reasoning is that it's not uncommon to place scripts in a `bin` directory outside of `src`, but still have them tested.

### string|array `bootstrap`

[](#stringarray-bootstrap)

The path(s) to file(s) ("bootstrapper(s)") every piece of code in your application needs. This is usually something that would reside in an `index.php`entry point or similar file. These files are otherwise ignored by Gentry when analysing your code and should do stuff like initialise an autoloader.

You can also pass an array of files instead of a string. They will be prepended in order.

`includePath` is parsed before `bootstrap`, so if you use them in conjunction you could use relative paths here. Otherwise, they will be relative to `get_cwd()`.

> Caution: if `bootstrap`ped files reside inside `src`, they won't be ignored. Gentry uses `require_once` of course, but if these files contain testable features it will try and do something sensible with them.

This isn't necessarily a bad thing; you could actually write tests that test the mock objects you use in other tests :)

### string `ignore`

[](#string-ignore)

A regular expression of classnames to ignore in the `"src"` path. Useful for automatically ignoring classtypes that are hard to test, e.g. controllers. You could also utilise this if your tests and sourcecode are mixed (but seriously, don't do that).

Usage
-----

[](#usage)

Now run Gentry from the command line and see what happens:

```
vendor/bin/gentry
```

It'll complain that it can't do anything yet. Which makes sense, we haven't written any tests yet!

Verbose mode
------------

[](#verbose-mode)

If you'd like more info, run Gentry with the `-v` flag:

```
vendor/bin/gentry -v
```

In the default mode, only important messages are displayed. But verbose mode might be handy when something's going wrong for you, or if you simply want feedback about stuff like incomplete tests.

Detecting the environment
-------------------------

[](#detecting-the-environment)

For a lot of testing, you'll need to detect whether or not to use a mock object (e.g. for database connections), or "the real thang". The simplest way is to check `getenv("GENTRY")` where needed. Gentry's executable sets that for you, so it's a sure-fire way of knowing you're in testing mode. Unless you're using that same environment variable yourself somewhere. But that would be silly.

Generating missing tests
------------------------

[](#generating-missing-tests)

Run Gentry with the `-g` flag to generate skeletons for missing tests for you:

```
vendor/bin/gentry -g
```

More on generating tests in the corresponding section of the manual.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

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

Total

45

Last Release

3714d ago

PHP version history (2 changes)0.7.0PHP &gt;=5.5

0.7.3PHP &gt;=7

### Community

Maintainers

![](https://www.gravatar.com/avatar/bce0289662bc7c78014afb3610eb7558b68948a97cb2f9b0efd1755d80dc7c2a?d=identicon)[monomelodies](/maintainers/monomelodies)

---

Top Contributors

[![monomelodies](https://avatars.githubusercontent.com/u/260346?v=4)](https://github.com/monomelodies "monomelodies (432 commits)")

### Embed Badge

![Health badge](/badges/monomelodies-gentry/health.svg)

```
[![Health](https://phpackages.com/badges/monomelodies-gentry/health.svg)](https://phpackages.com/packages/monomelodies-gentry)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[dama/doctrine-test-bundle

Symfony bundle to isolate doctrine database tests and improve test performance

1.2k37.2M144](/packages/dama-doctrine-test-bundle)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3287.8M898](/packages/szepeviktor-phpstan-wordpress)[codeception/module-asserts

Codeception module containing various assertions

8550.6M1.2k](/packages/codeception-module-asserts)[osteel/openapi-httpfoundation-testing

Validate HttpFoundation requests and responses against OpenAPI (3+) definitions

1201.9M6](/packages/osteel-openapi-httpfoundation-testing)

PHPackages © 2026

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