horat1us/yii2-phpunit

Yii 2 PHPUnit 兼容层和增强

0.0.5 2020-09-04 14:31 UTC

This package is auto-updated.

Last update: 2024-09-04 23:45:27 UTC


README

Yii 2 PHPUnit 兼容层和增强 此包包含

  • TestLogger - 将所有日志消息显示到控制台
  • TestMailer - 将所有发送的邮件收集到内存中
  • TestCase - 基础 TestCase,继承自 PHPUnit TestCase。在每个测试之前将创建新的 \yii\console\Application 实例并应用 Yii2 固定数据。
  • MigrateFixture - Yii2 固定数据,将应用迁移。用例:您的包包含迁移,您需要在测试之前应用它。

注意:此包假定支持依赖它的旧包

用法

  • 安装包并将 horat1us/yii2-phpunit 作为开发依赖项
composer require --dev horat1us/yii2-phpunit
  • 配置您的 PHPUnit 并创建包含别名配置的引导文件
<?php
// bootstrap.php

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

许可证

LICENSE

示例

有关详细信息,请参阅 horat1us/yii2-advanced-package