PHPackages                             spawnia/phpunit-assert-directory - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. spawnia/phpunit-assert-directory

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spawnia/phpunit-assert-directory
================================

PHPUnit extension with assert methods for directories

v2.2.0(2y ago)019.6k↓64.3%1MITPHPPHP ^7.3 || ^8CI failing

Since Sep 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/spawnia/phpunit-assert-directory)[ Packagist](https://packagist.org/packages/spawnia/phpunit-assert-directory)[ Docs](https://github.com/spawnia/phpunit-assert-directory)[ GitHub Sponsors](https://github.com/spawnia)[ RSS](/packages/spawnia-phpunit-assert-directory/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (9)Versions (6)Used By (1)

phpunit-assert-directory
========================

[](#phpunit-assert-directory)

PHPUnit extension with assert methods for directories

Installation
------------

[](#installation)

Install through composer.

```
composer require --dev spawnia/phpunit-assert-directory
```

Usage
-----

[](#usage)

Use the trait `AssertDirectory` in your test method.

```
namespace Foo\Tests;

use PHPUnit\Framework\TestCase;
+use Spawnia\PHPUnitAssertFiles\AssertDirectory;

final class FooTest extends 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

[](#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

[](#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
---------

[](#changelog)

See [`CHANGELOG.md`](CHANGELOG.md).

Contributing
------------

[](#contributing)

See [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

License
-------

[](#license)

This package is licensed using the MIT License.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance53

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~422 days

Total

5

Last Release

799d ago

Major Versions

v0.1.0 → v1.0.02019-12-18

v1.0.0 → v2.0.02019-12-21

PHP version history (2 changes)v0.1.0PHP ^7.3

v2.1.0PHP ^7.3 || ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ff5d1af2c0f601f7ed7e75e15be0aa4c062149b57fd5aace4e44cc37b8b7a40?d=identicon)[spawnia](/maintainers/spawnia)

---

Top Contributors

[![spawnia](https://avatars.githubusercontent.com/u/12158000?v=4)](https://github.com/spawnia "spawnia (23 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spawnia-phpunit-assert-directory/health.svg)

```
[![Health](https://phpackages.com/badges/spawnia-phpunit-assert-directory/health.svg)](https://phpackages.com/packages/spawnia-phpunit-assert-directory)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M986](/packages/brianium-paratest)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k28.9M2.4k](/packages/infection-infection)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M343](/packages/drupal-core-dev)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

30314.4k7](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
