Yii 2 PHPUnit compatibility layer and enhancements

1.0.1 2019-08-08 12:41 UTC

This package is auto-updated.

Last update: 2020-03-08 14:09:35 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\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.


  • Install package and phpunit/phpunit as dev dependencies
composer require --dev yiisoft/yii2-phpunit phpunit/phpunit
  • Configure your PHPUnit and create bootstrap file with alias to config:
// bootstrap.php

Yii::setAlias('@configFile', 'path-to-config.php');


See horat1us/yii2-advanced-package for details.