horat1us/yii2-phpunit

Yii 2 PHPUnit compatibility layer and enhancements

0.0.5 2020-09-04 14:31 UTC

This package is auto-updated.

Last update: 2024-11-05 00:15:49 UTC


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');

License

LICENSE

Example

See horat1us/yii2-advanced-package for details.