PHPackages                             illuminated/testing-tools - 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. illuminated/testing-tools

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

illuminated/testing-tools
=========================

Laravel-specific Testing Helpers and Assertions.

12.0.0(1y ago)5420.4k↑184.1%715MITPHPPHP ^8.2CI passing

Since Dec 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/dmitry-ivanov/laravel-testing-tools)[ Packagist](https://packagist.org/packages/illuminated/testing-tools)[ RSS](/packages/illuminated-testing-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (106)Used By (15)

[![Laravel-specific Testing Helpers and Assertions](art/1380x575-optimized.jpg)](art/1380x575-optimized.jpg)

Laravel Testing Tools
=====================

[](#laravel-testing-tools)

[![Buy me a coffee](https://user-images.githubusercontent.com/1286821/181085373-12eee197-187a-4438-90fe-571ac6d68900.png)](https://buymeacoffee.com/dmitry.ivanov)

[![StyleCI](https://camo.githubusercontent.com/d087b3e9a93738c2def04c4905ae184fb341f6a1a0368c95c440d9ac42b3c2a3/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f37353431343632362f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/75414626?branch=master)[![Build Status](https://camo.githubusercontent.com/7423149de3603430b01a8b06024fad8b86de5a6aacfca83ba7a78092a58400cb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f646d697472792d6976616e6f762f6c61726176656c2d74657374696e672d746f6f6c732f74657374732e796d6c3f6272616e63683d6d6173746572)](https://github.com/dmitry-ivanov/laravel-testing-tools/actions?query=workflow%3Atests+branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/9d07d97d780a509a4cc0db58eaa69f06d6d7658506c849f09e02d36469dd822a/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f646d697472792d6976616e6f762f6c61726176656c2d74657374696e672d746f6f6c732f6d6173746572)](https://app.codecov.io/gh/dmitry-ivanov/laravel-testing-tools/tree/master)

[![Packagist Version](https://camo.githubusercontent.com/e01440cef212cb6e0ceb211310f257ad38a54004d31acbb804146665d3ba6afe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d696e617465642f74657374696e672d746f6f6c73)](https://camo.githubusercontent.com/e01440cef212cb6e0ceb211310f257ad38a54004d31acbb804146665d3ba6afe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696c6c756d696e617465642f74657374696e672d746f6f6c73)[![Packagist Stars](https://camo.githubusercontent.com/0cac3c04d4084c1285a204f7aa0d9a830e15911d30523a9d84caa197073710b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f696c6c756d696e617465642f74657374696e672d746f6f6c73)](https://camo.githubusercontent.com/0cac3c04d4084c1285a204f7aa0d9a830e15911d30523a9d84caa197073710b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f696c6c756d696e617465642f74657374696e672d746f6f6c73)[![Packagist Downloads](https://camo.githubusercontent.com/2a8b7a022ca240e7627840f19af3d74fe3833bb8c8850b927ff9aed209257d2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696c6c756d696e617465642f74657374696e672d746f6f6c73)](https://camo.githubusercontent.com/2a8b7a022ca240e7627840f19af3d74fe3833bb8c8850b927ff9aed209257d2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696c6c756d696e617465642f74657374696e672d746f6f6c73)[![Packagist License](https://camo.githubusercontent.com/8aaca6f2aca75503a3e8c721923442b7c99d1bc0a9bdc59a64d2eb6be95cfad9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696c6c756d696e617465642f74657374696e672d746f6f6c73)](https://camo.githubusercontent.com/8aaca6f2aca75503a3e8c721923442b7c99d1bc0a9bdc59a64d2eb6be95cfad9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696c6c756d696e617465642f74657374696e672d746f6f6c73)

Laravel-specific Testing Helpers and Assertions.

LaravelTesting Tools12.x[12.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/12.x)11.x[11.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/11.x)10.x[10.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/10.x)9.x[9.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/9.x)8.x[8.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/8.x)7.x[7.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/7.x)6.x[6.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/6.x)5.8.\*[5.8.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.8)5.7.\*[5.7.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.7)5.6.\*[5.6.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.6)5.5.\*[5.5.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.5)5.4.\*[5.4.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.4)5.3.\*[5.3.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.3)5.2.\*[5.2.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.2)5.1.\*[5.1.\*](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/5.1)Usage
-----

[](#usage)

1. Install the package via Composer:

    ```
    composer require --dev illuminated/testing-tools
    ```
2. Use `Illuminated\Testing\TestingTools` trait:

    ```
    use Illuminated\Testing\TestingTools;

    abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
    {
        use TestingTools;

        // ...
    }
    ```
3. Use any of the provided helpers and assertions in your tests:

    ```
    class ExampleTest extends TestCase
    {
        #[Test]
        public function it_has_lots_of_useful_assertions()
        {
            $this->assertDatabaseHasMany('posts', [
                ['title' => 'Awesome!'],
                ['title' => 'Check multiple rows'],
                ['title' => 'In one simple assertion 🤟'],
            ]);
        }
    }
    ```

Available helpers
-----------------

[](#available-helpers)

> Feel free to contribute.

- [ApplicationHelpers](#applicationhelpers)
    - [emulateLocal](#emulatelocal)
    - [emulateProduction](#emulateproduction)
    - [emulateEnvironment](#emulateenvironment)

Available assertions
--------------------

[](#available-assertions)

> Feel free to contribute.

- [CollectionAsserts](#collectionasserts)
    - [assertCollectionsEqual](#assertcollectionsequal)
    - [assertCollectionsNotEqual](#assertcollectionsnotequal)
- [DatabaseAsserts](#databaseasserts)
    - [assertDatabaseHasTable](#assertdatabasehastable)
    - [assertDatabaseMissingTable](#assertdatabasemissingtable)
    - [assertDatabaseHasMany](#assertdatabasehasmany)
    - [assertDatabaseMissingMany](#assertdatabasemissingmany)
- [FilesystemAsserts](#filesystemasserts)
    - [assertDirectoryEmpty](#assertdirectoryempty)
    - [assertDirectoryNotEmpty](#assertdirectorynotempty)
    - [assertFilesCount](#assertfilescount)
    - [assertNotFilesCount](#assertnotfilescount)
- [LogFileAsserts](#logfileasserts)
    - [seeLogFile](#seelogfile)
    - [dontSeeLogFile](#dontseelogfile)
    - [seeInLogFile](#seeinlogfile)
    - [dontSeeInLogFile](#dontseeinlogfile)
- [ScheduleAsserts](#scheduleasserts)
    - [seeScheduleCount](#seeschedulecount)
    - [dontSeeScheduleCount](#dontseeschedulecount)
    - [seeInSchedule](#seeinschedule)
    - [dontSeeInSchedule](#dontseeinschedule)

Helpers
-------

[](#helpers)

### ApplicationHelpers

[](#applicationhelpers)

#### `emulateLocal()`

[](#emulatelocal)

Emulate that application is running on the `local` environment:

```
$this->emulateLocal();
```

#### `emulateProduction()`

[](#emulateproduction)

Emulate that application is running on the `production` environment:

```
$this->emulateProduction();
```

#### `emulateEnvironment()`

[](#emulateenvironment)

Emulate that application is running on the given environment:

```
$this->emulateEnvironment('demo');
```

Assertions
----------

[](#assertions)

### CollectionAsserts

[](#collectionasserts)

#### `assertCollectionsEqual()`

[](#assertcollectionsequal)

Assert that the given collections are equal based on the specified key:

```
$this->assertCollectionsEqual($collection1, $collection2, 'id');
```

#### `assertCollectionsNotEqual()`

[](#assertcollectionsnotequal)

Assert that the given collections are not equal based on the specified key:

```
$this->assertCollectionsNotEqual($collection1, $collection2, 'id');
```

### DatabaseAsserts

[](#databaseasserts)

#### `assertDatabaseHasTable()`

[](#assertdatabasehastable)

Assert that the database has the given table:

```
$this->assertDatabaseHasTable('users');
```

#### `assertDatabaseMissingTable()`

[](#assertdatabasemissingtable)

Assert that the database doesn't have the given table:

```
$this->assertDatabaseMissingTable('unicorns');
```

#### `assertDatabaseHasMany()`

[](#assertdatabasehasmany)

Assert that the database has all the given rows:

```
$this->assertDatabaseHasMany('posts', [
    ['title' => 'First Post'],
    ['title' => 'Second Post'],
    ['title' => 'Third Post'],
]);
```

#### `assertDatabaseMissingMany()`

[](#assertdatabasemissingmany)

Assert that the database doesn't have all the given rows:

```
$this->assertDatabaseMissingMany('posts', [
    ['title' => 'Fourth Post'],
    ['title' => 'Fifth Post'],
]);
```

### FilesystemAsserts

[](#filesystemasserts)

#### `assertDirectoryEmpty()`

[](#assertdirectoryempty)

Assert that the given directory is empty:

```
$this->assertDirectoryEmpty('./my/dir/');
```

#### `assertDirectoryNotEmpty()`

[](#assertdirectorynotempty)

Assert that the given directory is not empty:

```
$this->assertDirectoryNotEmpty('./my/dir/');
```

#### `assertFilesCount()`

[](#assertfilescount)

Assert that directory has the given number of files:

```
$this->assertFilesCount('./my/dir/', 3);
```

#### `assertNotFilesCount()`

[](#assertnotfilescount)

Assert that directory doesn't have the given number of files:

```
$this->assertNotFilesCount('./my/dir/', 5);
```

### LogFileAsserts

[](#logfileasserts)

#### `seeLogFile()`

[](#seelogfile)

Assert that the given log file exists.

The path is relative to the `storage/logs` folder:

```
$this->seeLogFile('example.log');
```

#### `dontSeeLogFile()`

[](#dontseelogfile)

Assert that the given log file doesn't exist.

The path is relative to the `storage/logs` folder:

```
$this->dontSeeLogFile('foo.log');
```

#### `seeInLogFile()`

[](#seeinlogfile)

Assert that the log file contains the given message.

The path is relative to the `storage/logs` folder:

```
$this->seeInLogFile('example.log', 'Sample log message!');
```

Also, you can specify an array of messages:

```
$this->seeInLogFile('example.log', [
    'Sample log message 1!',
    'Sample log message 2!',
    'Sample log message 3!',
]);
```

You can use these placeholders in messages:

- `%datetime%` - any datetime string.

```
$this->seeInLogFile('example.log', '[%datetime%]: Sample log message!');
```

#### `dontSeeInLogFile()`

[](#dontseeinlogfile)

Assert that the log file doesn't contain the given message.

The path is relative to the `storage/logs` folder:

```
$this->dontSeeInLogFile('example.log', 'Non-existing log message!');
```

Also, you can specify an array of messages:

```
$this->dontSeeInLogFile('example.log', [
    'Non-existing log message 1!',
    'Non-existing log message 2!',
    'Non-existing log message 3!',
]);
```

### ScheduleAsserts

[](#scheduleasserts)

#### `seeScheduleCount()`

[](#seeschedulecount)

Assert that schedule count equals to the given value:

```
$this->seeScheduleCount(3);
```

#### `dontSeeScheduleCount()`

[](#dontseeschedulecount)

Assert that schedule count doesn't equal to the given value:

```
$this->dontSeeScheduleCount(5);
```

#### `seeInSchedule()`

[](#seeinschedule)

Assert that the given command is scheduled:

```
$this->seeInSchedule('foo', 'everyFiveMinutes');
$this->seeInSchedule('bar', 'hourly');
$this->seeInSchedule('baz', 'twiceDaily');
```

Also, you can use cron expressions:

```
$this->seeInSchedule('foo', '*/5 * * * * *');
$this->seeInSchedule('bar', '0 * * * * *');
$this->seeInSchedule('baz', '0 1,13 * * * *');
```

#### `dontSeeInSchedule()`

[](#dontseeinschedule)

Assert that the given command is not scheduled:

```
$this->dontSeeInSchedule('foo');
```

Sponsors
--------

[](#sponsors)

[![Laravel Idea](art/sponsor-laravel-idea.png)](https://laravel-idea.com)
[![Material Theme UI Plugin](art/sponsor-material-theme.png)](https://material-theme.com)

License
-------

[](#license)

Laravel Testing Tools is open-sourced software licensed under the [MIT license](LICENSE.md).

[![Buy me a coffee](https://user-images.githubusercontent.com/1286821/181085373-12eee197-187a-4438-90fe-571ac6d68900.png)](https://buymeacoffee.com/dmitry.ivanov)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance47

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.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 ~29 days

Recently: every ~91 days

Total

105

Last Release

429d ago

Major Versions

7.x-dev → 8.x-dev2021-03-04

8.x-dev → 9.0.02022-02-19

9.x-dev → 10.x-dev2024-03-06

10.0.0 → 11.0.02025-03-05

11.x-dev → 12.x-dev2025-03-06

PHP version history (12 changes)0.1.0PHP &gt;=5.6.4

0.5.1PHP &gt;=5.5.9

5.5.0PHP &gt;=7.0

5.6.0PHP ^7.1.3

6.0.0PHP ^7.2

7.0.0PHP ^7.2.5

8.0.0PHP ^7.3

6.2.0PHP ^7.2.5|^8.0

8.1.0PHP ^7.3|^8.0

9.0.0PHP ^8.0.2

10.x-devPHP ^8.1

11.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b6a68d578b4021fbe05838e8e71ccd44b07879ffda6b7ec05c1deb65d0c88f8?d=identicon)[dmitry-ivanov](/maintainers/dmitry-ivanov)

---

Top Contributors

[![dmitry-ivanov](https://avatars.githubusercontent.com/u/1286821?v=4)](https://github.com/dmitry-ivanov "dmitry-ivanov (601 commits)")[![mihan007](https://avatars.githubusercontent.com/u/939122?v=4)](https://github.com/mihan007 "mihan007 (1 commits)")

---

Tags

assertion-functionsassertion-methodsassertionshelperslaravellaravel-packagetestingtoolstestinglaravelhelpersassertionstoolsassertion-methodsassertion-functions

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/illuminated-testing-tools/health.svg)

```
[![Health](https://phpackages.com/badges/illuminated-testing-tools/health.svg)](https://phpackages.com/packages/illuminated-testing-tools)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.1k](/packages/larastan-larastan)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)[timacdonald/log-fake

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

4235.9M54](/packages/timacdonald-log-fake)[sti3bas/laravel-scout-array-driver

Array driver for Laravel Scout

971.5M3](/packages/sti3bas-laravel-scout-array-driver)[davestewart/sketchpad

An innovative front-end environment for interactive Laravel development

29512.9k1](/packages/davestewart-sketchpad)[christophrumpel/missing-livewire-assertions

This package adds missing livewire test assertions.

149336.0k9](/packages/christophrumpel-missing-livewire-assertions)

PHPackages © 2026

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