harmonyio / phpunit-extension
PHPUnit 的异步助手
v1.0.0-rc1
2018-12-24 18:07 UTC
Requires
- php: ^7.3
- amphp/amp: ^2.1.1
- phpunit/phpunit: ^7.5.1
Requires (Dev)
- harmonyio/php-codesniffer-ruleset: 1.0.0-rc1
- maglnet/composer-require-checker: ^1.1.0
- slevomat/coding-standard: ^4.8.6
- squizlabs/php_codesniffer: ^3.4.0
This package is auto-updated.
Last update: 2024-08-29 04:54:31 UTC
README
异步 PHPUnit 助手
要求
- PHP 7.3
此外,对于非阻塞上下文,应安装以下事件库之一
安装
composer require harmonyio/phpunit-extension
使用
PHPUnit 的断言可以在承诺上透明地使用。承诺将自动解析为其值,最终值将进行断言。
<?php declare(strict_types=1); namespace Foo\Test\Unit; use Amp\Success; use HarmonyIO\PHPUnitExtension\TestCase; class BarTest extends TestCase { public function testPromiseValueAssertsCorrectly(): void { // the promise will be automatically resolved here // and the eventual value will be asserted instead of the promise itself $this->assertTrue(new Success(true)); } }