This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
Yii 2 PHPUnit compatibility layer and enhancements
0.0.5 2020-09-04 14:31 UTC
Yii 2 PHPUnit compatibility layer and enhancements This package includes:
- TestLogger - will display all log messages to console
- TestMailer - will collect all sent mails in memory
- TestCase - base TestCase, extends PHPUnit TestCase.
It will create new
\yii\console\Applicationinstance before each test and apply Yii2 fixtures.
- MigrateFixture - Yii2 fixture that will apply migration. Use case: your package contains migrations and you need to apply it before tests.
Note: this package supposed to support old packages, that depends on it
- Install package and horat1us/yii2-phpunit as dev dependencies
composer require --dev horat1us/yii2-phpunit
- Configure your PHPUnit and create bootstrap file with alias to config:
<?php // bootstrap.php Yii::setAlias('@configFile', 'path-to-config.php');
- Create your test cases that extend Horat1us\Yii\PHPUnit\TestCase
See horat1us/yii2-advanced-package for details.