spawnia / phpunit-assert-directory
PHPUnit extension with assert methods for directories
Fund package maintenance!
spawnia
Installs: 3 566
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.3
- thecodingmachine/safe: ^1.0.0
Requires (Dev)
- infection/infection: ~0.13.6
- jangregor/phpstan-prophecy: ~0.4.2
- localheinz/composer-normalize: ^1.3.1
- phpstan/phpstan: ~0.11.15
- phpstan/phpstan-deprecation-rules: ~0.11.2
- phpstan/phpstan-strict-rules: ~0.11.1
- phpunit/phpunit: ^8.3.4
- thecodingmachine/phpstan-safe-rule: v1.0.0-beta1
This package is auto-updated.
Last update: 2022-06-21 18:47:41 UTC
README
PHPUnit extension with assert methods for directories
Installation
Install through composer
composer require --dev spawnia/phpunit-assert-directory
Usage
Use the trait AssertDirectory
in your test method.
<?php declare(strict_types=1); namespace Foo\Tests; use PHPUnit\Framework; +use Spawnia\PHPUnitAssertFiles\AssertDirectory; class FooTest extends Framework\TestCase { + use AssertDirectory; }
You can then proceed the use the additional assertions just like you would
use PHPUnit's built-in methods, such as 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
Please have a look at CHANGELOG.md
.
Contributing
Please have a look at CONTRIBUTING.md
.
License
This package is licensed using the MIT License.