PHPackages                             phalcon/talon - 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. phalcon/talon

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

phalcon/talon
=============

Test harness and Phalcon bootstrapping for PHPUnit and beyond

v0.1(today)00BSD-3-ClausePHPPHP ^8.1CI passing

Since Jun 27Pushed todayCompare

[ Source](https://github.com/phalcon/talon)[ Packagist](https://packagist.org/packages/phalcon/talon)[ GitHub Sponsors](https://github.com/phalcon)[ Fund](https://opencollective.com/phalcon)[ RSS](/packages/phalcon-talon/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

Phalcon Talon
=============

[](#phalcon-talon)

[![Latest Version](https://camo.githubusercontent.com/9f8aa9030e982298c2d31673302607dbfb7af1f9bd158f8339d91df8b19b5819/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068616c636f6e2f74616c6f6e3f696e636c7564655f70726572656c6561736573267374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/phalcon/talon)[![PHP Version](https://camo.githubusercontent.com/f680b0154f8fc5b38d00575761c80a9c938c72365a7bb112fb5ba4d2061014af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068616c636f6e2f74616c6f6e3f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/phalcon/talon)[![Total Downloads](https://camo.githubusercontent.com/433ecfc1c73f2aac00e2030b4769509542e1126bd1b0ca13d37a9cfd8d08484b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068616c636f6e2f74616c6f6e3f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/phalcon/talon/stats)[![License](https://camo.githubusercontent.com/8284758de5023e3f2ca3c3742d33e74112746bcb5056bb883915730cf1fefaed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068616c636f6e2f74616c6f6e3f7374796c653d666c61742d737175617265266c6f676f3d6f70656e736f75726365696e6974696174697665266c6f676f436f6c6f723d7768697465)](https://github.com/phalcon/talon/blob/master/LICENSE)

[![Talon CI](https://github.com/phalcon/talon/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/phalcon/talon/actions/workflows/main.yml)[![Quality Gate Status](https://camo.githubusercontent.com/f14155d74aa57632da7e6937a8660068748671714d4f237a169d4eebb271fcc8/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068616c636f6e5f74616c6f6e266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=phalcon_talon)[![Coverage](https://camo.githubusercontent.com/315af3f19ca0924a15979da4cd02fd97915d629b6900f29f851f28d904ca58c6/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7068616c636f6e5f74616c6f6e266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=phalcon_talon)[![PDS Skeleton](https://camo.githubusercontent.com/50d01a5094afcc3a827c3cadaec43d23b2a256cb249f5fdd6e5ffdb53ea7971c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-pds/skeleton)

[![Discord](https://camo.githubusercontent.com/94fc3d9eff10556bb8115023b0f05a2b7465d01e863e0d7bb030e8fc51cfcf56/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3331303931303438383135323337353239373f6c6162656c3d446973636f7264266c6f676f3d646973636f7264267374796c653d666c61742d737175617265)](https://phalcon.io/discord)[![Contributors](https://camo.githubusercontent.com/c2cf2d0d9f6b7a2b08bd4d223aa484662c693603c8bf1f6388c7b8b5c336ae4e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f7068616c636f6e2f74616c6f6e3f7374796c653d666c61742d737175617265266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/phalcon/talon/graphs/contributors)[![OpenCollective Backers](https://camo.githubusercontent.com/b0e7e54861423843ca8c0b82b3cbdbd7e43557493dee35be2c721a9cc21107a1/68747470733a2f2f696d672e736869656c64732e696f2f6f70656e636f6c6c6563746976652f6261636b6572732f7068616c636f6e3f7374796c653d666c61742d737175617265266c6f676f3d6f70656e636f6c6c656374697665266c6f676f436f6c6f723d7768697465)](https://opencollective.com/phalcon)[![OpenCollective Sponsors](https://camo.githubusercontent.com/09f0801da6213d104e2283e28a70b5b5c9aa25076b9211442e403187c64ca12b/68747470733a2f2f696d672e736869656c64732e696f2f6f70656e636f6c6c6563746976652f73706f6e736f72732f7068616c636f6e3f7374796c653d666c61742d737175617265266c6f676f3d6f70656e636f6c6c656374697665266c6f676f436f6c6f723d7768697465)](https://opencollective.com/phalcon)

Test harness and Phalcon bootstrapping for PHPUnit and beyond - the part of Phalcon that catches the bugs.

Talon provides framework-neutral **traits** (the core), ready-to-extend **PHPUnit base classes**, and a one-liner **bootstrap** so any Phalcon project can write unit, integration, and functional tests with minimal boilerplate.

Requirements
------------

[](#requirements)

- PHP `^8.1`
- Phalcon - either the `ext-phalcon` C extension (`^5`) **or** the `phalcon/phalcon` PHP implementation (`^6`). Talon detects whichever is present.

Install
-------

[](#install)

```
composer require --dev phalcon/talon
```

Bootstrap (one-liner)
---------------------

[](#bootstrap-one-liner)

```
// tests/bootstrap.php
require __DIR__ . '/../vendor/autoload.php';

use Phalcon\Talon\Settings;
use Phalcon\Talon\Talon;

Talon::boot(Settings::fromEnv());
```

Need setup hooks (the old `loadIni` / `loadFolders`)? Use the bootstrap runner:

```
use Phalcon\Talon\Bootstrap\Runner;
use Phalcon\Talon\Bootstrap\Stage;
use Phalcon\Talon\Settings;

Runner::for(Settings::fromArray(['root' => __DIR__ . '/..']))
    ->before(Stage::Environment, fn () => ini_set('memory_limit', '512M'))
    ->after(Stage::Directories, fn ($settings) => mkdir($settings->outputPath('screens'), 0777, true))
    ->boot();
```

Unit tests
----------

[](#unit-tests)

```
use Phalcon\Talon\PHPUnit\AbstractUnitTestCase;

final class CalculatorTest extends AbstractUnitTestCase
{
    public function testInternal(): void
    {
        $this->assertSame(5, $this->callProtectedMethod(new Calculator(), 'add', 2, 3));
    }
}
```

`AbstractUnitTestCase` gives you `callProtectedMethod()`, `getProtectedProperty()`, `setProtectedProperty()`, `invokeMethod()`, `getNewFileName()`, `safeDeleteFile()`, `safeDeleteDirectory()`, `assertFileContentsContains()`, `checkExtensionIsLoaded()`, and `checkPhalconAvailable()`.

Database tests
--------------

[](#database-tests)

```
use Phalcon\Talon\PHPUnit\AbstractDatabaseTestCase;

final class UserTest extends AbstractDatabaseTestCase
{
    public function testSeeded(): void
    {
        $this->assertInDatabase('users', ['email' => 'nikos@niden.net']);
    }
}
```

The driver comes from the `driver` env (`sqlite`, `mysql`, `pgsql`); credentials come from `Settings` (env vars by default - see `resources/.env.example`).

Functional tests
----------------

[](#functional-tests)

The package never owns your container - hand it your configured application:

```
use Phalcon\Talon\PHPUnit\AbstractFunctionalTestCase;

final class HomeTest extends AbstractFunctionalTestCase
{
    protected function appFactory(): callable
    {
        return fn () => require __DIR__ . '/../app/bootstrap.php'; // returns a configured Application/Micro
    }

    public function testHome(): void
    {
        $this->dispatch('/');
        $this->assertController('index');
        $this->assertResponseContentContains('Welcome');
    }
}
```

Service tests (Redis / Memcached)
---------------------------------

[](#service-tests-redis--memcached)

```
use Phalcon\Talon\PHPUnit\AbstractServicesTestCase;

final class CacheTest extends AbstractServicesTestCase
{
    public function testRedis(): void
    {
        $this->setRedisKey('key', 'value');
        $this->assertSame('value', $this->getRedisKey('key'));
    }
}
```

Service tests skip automatically when the backend is unreachable.

Mocking a Resultset (no database)
---------------------------------

[](#mocking-a-resultset-no-database)

```
use Phalcon\Talon\Traits\ResultSetTrait;

final class ReportTest extends \PHPUnit\Framework\TestCase
{
    use ResultSetTrait;

    public function testReport(): void
    {
        $resultset = $this->mockResultSet([$modelA, $modelB]);
        $this->assertCount(2, $resultset);
    }
}
```

Custom configuration
--------------------

[](#custom-configuration)

Override `getSettings()` in a project base class, or pass `Settings::fromArray([...])` to `Talon::boot()`:

```
Talon::boot(Settings::fromArray([
    'root' => dirname(__DIR__),
    'db'   => [
        'mysql'  => ['host' => '127.0.0.1', 'port' => 3306, 'dbname' => 'app', 'username' => 'root', 'password' => ''],
        'sqlite' => ['dbname' => ':memory:'],
    ],
]));
```

Beyond PHPUnit
--------------

[](#beyond-phpunit)

The traits are the core public API and carry no PHPUnit base-class requirement for their non-assertion helpers, so Pest (`uses(...)`) and other runners can consume them too. Pest and Codeception adapters are planned for a future release.

License
-------

[](#license)

BSD-3-Clause. See [LICENSE](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.7% 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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1221505?v=4)[The Phalcon PHP Framework](/maintainers/phalcon)[@phalcon](https://github.com/phalcon)

---

Top Contributors

[![niden](https://avatars.githubusercontent.com/u/1073784?v=4)](https://github.com/niden "niden (43 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

testingphpunittestphalconharness

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phalcon-talon/health.svg)

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

###  Alternatives

[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10953.8M18](/packages/ta-tikoma-phpunit-architecture-test)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.7M509](/packages/php-mock-php-mock-phpunit)[fr3d/swagger-assertions

Test your API requests and responses against your swagger definition

138866.1k5](/packages/fr3d-swagger-assertions)[albertcht/lumen-testing

Testing Suite For Lumen like Laravel does.

4335.8k1](/packages/albertcht-lumen-testing)

PHPackages © 2026

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