PHPackages                             illusiard/yii2-testkit - 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. illusiard/yii2-testkit

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

illusiard/yii2-testkit
======================

Minimal Yii2 testing kit with Codeception templates and a Docker test stand.

v0.3.0(3w ago)073BSD-3-ClausePHPPHP ^8.5

Since Feb 9Pushed 2mo agoCompare

[ Source](https://github.com/Illusiard/yii2-testkit)[ Packagist](https://packagist.org/packages/illusiard/yii2-testkit)[ RSS](/packages/illusiard-yii2-testkit/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (12)Versions (4)Used By (3)

illusiard/yii2-testkit
======================

[](#illusiardyii2-testkit)

**Short Description**

Минимальный каркас для тестирования Yii2 расширений и приложений. Пакет даёт базовые TestCase и шаблоны Codeception без лишней логики.

**Installation**

Установите пакет как dev-зависимость:

```
composer require --dev illusiard/yii2-testkit
```

**Using In Yii2 Extension (Extension Mode)**

В расширении используйте `YiiTestCase` для поднятия минимального приложения:

```
use Illusiard\Yii2Testkit\Testing\YiiTestCase;

final class MyServiceTest extends YiiTestCase
{
    protected function appConfig(): array
    {
        return [
            'id' => 'test-app',
            'basePath' => __DIR__,
        ];
    }

    public function testSomething(): void
    {
        $this->assertNotNull(\Yii::$app);
    }
}
```

**Using In Yii2 Application (Basic / Advanced)**

В приложении используйте шаблоны `resources/codeception/*.yml` и настройте `configFile`/`entryScript` под структуру вашего проекта. Приложение поднимается самим Codeception через модуль Yii2.

**Test Stand**

Пакет теперь включает минимальный встроенный слой test stand для Docker: `nginx + php-fpm` поднимаются всегда, а дополнительные сервисы выбираются через `Illusiard\Yii2Testkit\TestStand\TestServices`.

Для работы test stand нужен установленный `docker compose`.

Пример:

```
use Illusiard\Yii2Testkit\TestStand\StandConfig;
use Illusiard\Yii2Testkit\TestStand\StandManager;

$config = StandConfig::load(__DIR__ . '/tests/_config/stand.php');
$stand = new StandManager();

$stand->up($config, true);
$stand->logs($config);
$stand->down($config, true);
```

Структура конфига:

```
return [
    'services' => ['mysql', 'redis'],
    'envFiles' => ['/abs/path/to/test.env'],
    'appConfig' => [
        'projectRoot' => '/abs/path/to/project',
        'webRoot' => '/abs/path/to/project/web',
        'entryScript' => 'index-test.php',
    ],
];
```

Особенности:

- `app` не указывается в `services`: `nginx` и `php-fpm` поднимаются автоматически.
- Логи сохраняются в `tests/_output/testkit/` файлами `docker-compose.log` и `services.log`.
- Host port для nginx задаётся через переменную окружения `TESTKIT_HTTP_PORT`. Если она не задана, используется `8080`.
- `envFiles` передаются в контейнеры как runtime env-файлы, но не используются для выбора host port.

Поддерживаемые сервисы:

- `mysql`
- `postgresql`
- `redis`
- `rabbitmq`

Ограничения текущей версии: только встроенная docker-структура пакета (без внешних compose файлов), только HTTP, без миграций и фикстур, без HTTP-клиента и без app runner вне Docker.

**Test Suites Overview (Unit / Integration / Functional)**

- `unit`: тесты без Yii, базовый `UnitTestCase`.
- `integration`: тесты с Yii, обычно на основе `YiiTestCase`.
- `functional`: функциональные тесты в App Mode через модуль Yii2 и `configFile` приложения.

**License**

BSD-3-Clause. Подробности в `LICENSE`.

###  Health Score

39

↑

LowBetter than 84% of packages

Maintenance88

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

Total

3

Last Release

27d ago

PHP version history (2 changes)v0.1.0PHP &gt;=8.1

v0.3.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/514a2bdbd1dfc61512460d4026da34187fb5e20e69be3ada0a8594b593dd269a?d=identicon)[Illusiard](/maintainers/Illusiard)

---

Top Contributors

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

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/illusiard-yii2-testkit/health.svg)

```
[![Health](https://phpackages.com/badges/illusiard-yii2-testkit/health.svg)](https://phpackages.com/packages/illusiard-yii2-testkit)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14429.2M360](/packages/dms-phpunit-arraysubset-asserts)

PHPackages © 2026

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