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.1k↓50%1MITPHPPHP ^7.3 || ^8CI passing

Since Sep 11Pushed 2mo 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 1mo 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

41

—

FairBetter than 89% of packages

Maintenance58

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

753d 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

[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)[webmozarts/strict-phpunit

Enables type-safe comparisons of objects in PHPUnit

31252.7k5](/packages/webmozarts-strict-phpunit)

PHPackages © 2026

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