horat1us / yii2-phpunit
Yii 2 PHPUnit compatibility layer and enhancements
0.0.5
2020-09-04 14:31 UTC
Requires
- php: >=7.4
- phpunit/phpunit: ^9
- vlucas/phpdotenv: ^5.0
- yiisoft/yii2: ^2.0.35
Requires (Dev)
README
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\Application
instance 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
Usage
- 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
License
Example
See horat1us/yii2-advanced-package for details.