spawnia / phpunit-assert-directory
用于目录断言的PHPUnit扩展
v2.2.0
2024-04-26 09:46 UTC
Requires
- php: ^7.3 || ^8
- phpunit/phpunit: ^8 || ^9 || ^10 || ^11
- thecodingmachine/safe: ^1.3.3 || ^2
Requires (Dev)
README
用于目录断言的PHPUnit扩展
安装
通过composer安装。
composer require --dev spawnia/phpunit-assert-directory
用法
在测试方法中使用AssertDirectory
特性。
namespace Foo\Tests; use PHPUnit\Framework\TestCase; +use Spawnia\PHPUnitAssertFiles\AssertDirectory; final class FooTest extends TestCase { + use AssertDirectory; }
然后你可以像使用PHPUnit内置方法(如assertSame
)一样使用额外的断言。
assertDirectoryEquals
/** * Assert that two directories contain the same files with the same contents. * * @param string $expected Path to the expected directory * @param string $actual Path to the actual directory * @param string $message Optional error message in case of failure * * @throws ExpectationFailedException */ public static function assertDirectoryEquals(string $expected, string $actual, string $message = ''): void
assertDirectoryContains
/** * Assert a directory contains at least the same files as another directory. * * @param string $expected Path to the expected directory * @param string $actual Path to the actual directory * @param string $message Optional error message in case of failure * @return void * * @throws ExpectationFailedException */ public static function assertDirectoryContains(string $expected, string $actual, string $message = ''): void
变更日志
查看CHANGELOG.md
。
贡献
许可证
此包使用MIT许可证授权。