atoum / phpunit-extension
此包已被废弃,不再维护。未建议替代包。
atoum PHPUnit 扩展 - 使用 atoum 运行您的 PHPUnit 测试
0.6
2018-01-30 09:06 UTC
Requires
- atoum/atoum: dev-virtual-hooks as 3.3.0
Requires (Dev)
- phpunit/phpunit: @stable
README
此 atoum 扩展允许您使用 atoum 引擎运行现有的 PHPUnit 测试套件!如果您想从 PHPUnit 迁移到 atoum,这个扩展将是您的最佳伴侣!
目标
您的项目已经拥有 PHPUnit 测试套件。您爱上了 atoum。您想在项目中用 atoum 替换 PHPUnit。此扩展将允许您使用 atoum 运行您的 PHPUnit 测试套件,确保平稳迁移。
安装它
此扩展仍在开发中。您需要引用 atoum 的开发分支。
注意:我们需要您的帮助来完成扩展,因此请随时测试扩展并在发现问题时提交问题。
使用 Composer 安装扩展
{ "require-dev": { "atoum/atoum": "dev-virtual-hooks", "atoum/phpunit-extension": "~0.6" } }
使用 atoum 配置文件启用扩展
<?php // .atoum.php require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; use mageekguy\atoum\phpunit; $extension = new phpunit\extension($script); $extension->addToRunner($runner);
使用它
默认情况下,一切应该正常工作,只需像往常一样运行 atoum
,您的测试套件将执行。
如果您想将测试套件从 PHPUnit 切换到 atoum,并获得 atoum 的所有功能,请将测试套件的父类从 PHPUnit\Framework\TestCase
替换为 mageekguy\atoum\phpunit
-class EnumTest extends \PHPUnit\Framework\TestCase +class EnumTest extends \mageekguy\atoum\phpunit
享受吧!
支持
助手
方法 | 支持 |
---|---|
fail |
❌ |
markTestIncomplete |
❌ |
markTestSkipped |
✅ |
总计 | 33% |
断言
方法 | 支持 |
---|---|
assertArrayHasKey(mixed $key, array $array[, string $message = '']) |
✅ |
assertArrayNotHasKey |
❌ |
assertClassHasAttribute |
❌ |
assertClassNotHasAttribute |
❌ |
assertArraySubset(array $subset, array $array[, bool $strict = '', string $message = '']) |
✅ |
assertClassHasStaticAttribute |
❌ |
assertClassNotHasStaticAttribute |
❌ |
assertContains(mixed $needle, iterable $haystack[, string $message = '']) |
✅ |
assertContains(string $needle, string $haystack[, string $message = '', boolean $ignoreCase = FALSE]) |
✅ |
assertNotContains |
❌ |
assertContainsOnly(string $type, iterable $haystack[, boolean $isNativeType = NULL, string $message = '']) |
✅ |
assertContainsOnlyInstancesOf(string $classname, iterable $haystack[, string $message = '']) |
✅ |
assertNotContainsOnly |
❌ |
assertCount($expectedCount, $haystack[, string $message = '']) |
✅ |
assertNotCount($expectedCount, $haystack[, string $message = '']) |
✅ |
assertEmpty(mixed $actual[, string $message = '']) |
✅ |
assertNotEmpty(mixed $actual[, string $message = '']) |
✅ |
assertEqualXMLStructure |
❌ |
assertEquals(mixed $expected, mixed $actual[, string $message = '']) |
✅ |
assertEquals(float $expected, float $actual[, string $message = '', float $delta = 0]) |
✅ |
assertEquals(DOMDocument $expected, DOMDocument $actual[, string $message = '']) |
❌ |
assertEquals(object $expected, object $actual[, string $message = '']) |
✅ |
assertEquals(array $expected, array $actual[, string $message = '']) |
✅ |
assertNotEquals |
❌ |
assertFalse(bool $condition[, string $message = '']) |
✅ |
assertNotFalse |
❌ |
assertFileEquals |
❌ |
assertFileNotEquals |
❌ |
assertFileExists |
❌ |
assertFileNotExists |
❌ |
assertGreaterThan(mixed $expected, mixed $actual[, string $message = '']) |
✅ |
断言大于等于(mixed $expected, mixed $actual[, string $message = '']) |
✅ |
断言无穷大(mixed $variable[, string $message = '']) |
✅ |
断言有限(mixed $variable[, string $message = '']) |
✅ |
断言实例为($expected, $actual[, $message = '']) |
✅ |
断言不是实例为($expected, $actual[, $message = '']) |
❌ |
断言内部类型($expected, $actual[, $message = '']) |
✅ |
断言不是内部类型 |
❌ |
断言JSON文件等于JSON文件 |
❌ |
断言JSON字符串等于JSON文件 |
❌ |
断言JSON字符串等于JSON字符串 |
❌ |
断言小于 |
❌ |
断言小于等于 |
❌ |
断言NaN(mixed $variable[, string $message = '']) |
✅ |
断言为null(mixed $variable[, string $message = '']) |
✅ |
断言不为null(mixed $variable[, string $message = '']) |
✅ |
断言对象有属性(string $attribute[, string $message = '']) |
✅ |
断言对象没有属性(string $attribute[, string $message = '']) |
✅ |
断言正则表达式 |
❌ |
断言不是正则表达式 |
❌ |
断言字符串匹配格式 |
❌ |
断言字符串不匹配格式 |
❌ |
断言字符串匹配格式文件 |
❌ |
断言字符串不匹配格式文件 |
❌ |
断言相同(mixed $expected, mixed $actual[, string $message = '']) |
✅ |
断言不相同(mixed $expected, mixed $actual[, string $message = '']) |
✅ |
断言字符串以...结束 |
❌ |
断言字符串不以...结束 |
❌ |
断言字符串等于文件 |
❌ |
断言字符串不等于文件 |
❌ |
断言字符串以...开始 |
❌ |
断言字符串不以...开始 |
❌ |
断言值满足(mixed $value, PHPUnit_Framework_Constraint $constraint[, $message = '']) |
✅ |
断言为真(bool $condition[, string $message = '']) |
✅ |
断言不为真 |
❌ |
断言XML文件等于XML文件 |
❌ |
断言XML文件不等于XML文件 |
❌ |
断言XML字符串等于XML文件 |
❌ |
断言XML字符串不等于XML文件 |
❌ |
断言XML字符串等于XML字符串 |
❌ |
断言XML字符串不等于XML字符串 |
❌ |
总计 | 42.25% |
类
类 | 支持 | 映射到 |
---|---|---|
PHPUnit\Framework\TestCase |
✅ | mageekguy\atoum\phpunit\test |
PHPUnit\Framework\Constraint |
✅ | mageekguy\atoum\phpunit\constraint |
总计 | 100% |
异常
类 | 支持 | 映射到 |
---|---|---|
PHPUnit\Framework\AssertionFailedError |
✅ | mageekguy\atoum\asserter\exception |
PHPUnit\Framework\Exception |
✅ | mageekguy\atoum\exceptions\runtime |
PHPUnit\Framework\ExpectationFailedException |
✅ | mageekguy\atoum\phpunit\constraint\exception |
总计 | 100% |
注解
注解 | 支持 | 说明 |
---|---|---|
@author |
✅ | |
@after |
❌ | |
@afterClass |
❌ | |
@backupGlobals |
❌ | |
@backupStaticAttributes |
❌ | |
@before |
❌ | |
@beforeClass |
❌ | |
@codeCoverageIgnore* |
❌ | |
@covers |
✅ | 只考虑类名。 |
@coversDefaultClass |
✅ | |
@coversNothing |
✅ | |
@dataProvider |
✅ | |
@depends |
❌ | |
@expectedException |
❌ | |
@expectedExceptionCode |
❌ | |
@expectedExceptionMessage |
❌ | |
@expectedExceptionMessageRegExp |
❌ | |
@group |
✅ | |
@large |
✅ | 不支持严格模式失败 |
@medium |
✅ | 不支持严格模式失败 |
@preserveGlobalState |
❌ | |
@requires |
❌ | |
@runTestsInSeparateProcesses |
✅ | 不在子进程中保留全局状态 |
@runInSeparateProcess |
✅ | 不在子进程中保留全局状态 |
@small |
✅ | 不支持严格模式失败 |
@test |
❌ | |
@testdox |
❌ | |
@ticket |
❌ | |
@uses |
❌ | |
总计 | 37.93% |
链接
许可
phpunit-extension在BSD-3-Clause许可下发布。有关详细信息,请参阅附带LICENSE文件。