PHPackages                             jeroen-g/testassist - 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. jeroen-g/testassist

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

jeroen-g/testassist
===================

Helpers for testing with PHPUnit

1.5.2(6y ago)1108EUPL-1.1PHP

Since Jan 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Jeroen-G/testassist)[ Packagist](https://packagist.org/packages/jeroen-g/testassist)[ Docs](https://github.com/Jeroen-G/testAssist)[ RSS](/packages/jeroen-g-testassist/feed)WikiDiscussions master Synced today

READMEChangelog (9)DependenciesVersions (10)Used By (0)

TestAssist
==========

[](#testassist)

[![Latest Version on Packagist](https://camo.githubusercontent.com/24e7ad85573b596dcc9b59b47d24ab6e34160113994fd45ddbd83dce7817f91a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65726f656e2d672f746573746173736973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeroen-g/testassist)[![Total Downloads](https://camo.githubusercontent.com/c6d4ca339df7806bf0bd36bdd7f5052531803ffa71b6157974755ee0d5dc06a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a65726f656e2d672f746573746173736973742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeroen-g/testassist)[![StyleCI](https://camo.githubusercontent.com/30c4ee9e375abe5391ed454a669b25306e8cb28276d37e2817b41bede13870c2/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131353634313938312f736869656c64)](https://styleci.io/repos/115641981)

This package contains some nifty helpers and assertions that are made with Laravel in mind. The majority of functions are found in other packages, tutorials or repositories and credit is given for each function.

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

[](#installation)

Via Composer

```
$ composer require jeroen-g/testassist
```

Usage
-----

[](#usage)

All helpers are designed as traits and organised in components focused on browser, console and filesystem tests. If you want to have all helpers, simply use the general Assistants that will include all others for you.

```
use JeroenG\TestAssist\Assistants;

class MyTest {
    use Assistants;

    // ...
}
```

### General functions

[](#general-functions)

#### AssertIsCalled

[](#assertiscalled)

`use JeroenG\TestAssist\Assistants`

This function accepts two parameters, the first is the classname that needs to get called, the second is a callback during which the class should be called. And example would be an event listener:

```
public function test_this()
{
    $this->assertIsCalled(UserHasSignedUp::class, function() {
        User::create([....]);
    });
}
```

### Browser (Laravel Dusk)

[](#browser-laravel-dusk)

#### ClearCookiesBetweenTests

[](#clearcookiesbetweentests)

`use JeroenG\TestAssist\Browser\ClearCookiesBetweenTests`

Using this trait will make sure that between each test the user is logged out and all (session) cookies are deleted. The best way to use this is to alter your TestCase's `tearDown()`:

```
use JeroenG\TestAssist\Browser\ClearCookiesBetweenTests;

protected function tearDown()
{
    parent::tearDown();
    $this->clearCookies();
}
```

### Console

[](#console)

#### OutputAssertions

[](#outputassertions)

`use JeroenG\TestAssist\Console\OutputAssertions`

Contains two functions: `seeInConsoleOutput($text)` and 'doNotSeeInConsoleOutput($text)` to check whether or not the (un)expected text appears in the console output.

#### ExceptionHandling

[](#exceptionhandling)

`use JeroenG\TestAssist\Console\ExceptionHandling`

Use `disableExceptionHandling()` to get the entire stacktrace instead of a `error 500`-like message. Use `withExceptionHandling()` to reactivate Laravel's error rendering.

### Database

[](#database)

#### FabricateModels

[](#fabricatemodels)

`use JeroenG\TestAssist\Database\FabricateModels`

Containts two functions as shortcuts to Laravel's factory method to create/make model instances. The shortest use would be as follows:

```
$member = $this->create(User::class);
$member = $this->make(User::class);
```

#### DataAssertions

[](#dataassertions)

`use JeroenG\TestAssist\Database\DataAssertions`

Containts two methods to assert if an Eloquent model is inserted into the database (technically an alias for `assertDatabaseHas()`) or to assert that its row is updated or deleted.

```
$this->assertCreated('users', $member);
$this->assertUpdated('users', $member);
$this->assertDeleted('users', $member);
```

#### SQLiteRegex

[](#sqliteregex)

`use JeroenG\TestAssist\Database\SQLiteRegex`

Add the function below to your `SetUpBeforeClass` to give SQLite the ability to use `REGEXP` statements. More information [here](https://stackoverflow.com/questions/5071601/how-do-i-use-regex-in-a-sqlite-query) and credits should go [here](https://gist.github.com/wingsline/4441139).

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

#### SeedDatabase

[](#seeddatabase)

`use JeroenG\TestAssist\Database\SeedDatabase`

Runs your `DatabaseSeeder` class if you use the trait. In your testcase's `setUp` method you should run this:

```
// At the top of your class:
use JeroenG\TestAssist\Assistants;

// in setUp():
$this->runSeeder();
```

If you do not use the whole set of assistants (see top of usage section), place the following code in your `setUp()` method to run it only once:

```
// If Concerns\SeedDatabase is used, go seed the database, but only once per class.
if (isset(static::$seedDatabase) && static::$seedDatabase != false) {
    $this->seedDatabase();
    static::$seedDatabase = false;
}
```

### Filesystem

[](#filesystem)

#### ManageFilesystem

[](#managefilesystem)

`use JeroenG\TestAssist\Filesystem\ManageFilesystem`

As the moment this trait has only the function `removeDir($path)` to nuke the directory and everything inside of it.

#### FileAssertions

[](#fileassertions)

`use JeroenG\TestAssist\Filesystem\FileAssertions`

There are several assertions present to work with the (non)existence of files and directories.

```
function test_filesystem() {
    $this->assertFileExistsOnDisk($filename); // Optionally pass the storage disk (defualt: local)
    $this->assertFileNotExistsOnDisk($filename);
    $this->assertFileExistsInZip($zipPath, $filename);
    $this->assertFileDoesntExistsInZip($zipPath, $filename);
}
```

The underlying functions such as `pathExists()` are of course also available for use.

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Credits
-------

[](#credits)

- [JeroenG](https://github.com/jeroen-g)
- [All Contributors](../../contributors%5D)

License
-------

[](#license)

EUPL-1.1. Please see the [license file](license.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~66 days

Recently: every ~77 days

Total

9

Last Release

2512d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d8700d69abe733de151f8cf49084e99ded7b9d34d7b0d1cd8f3825f5d925ff3?d=identicon)[JeroenG](/maintainers/JeroenG)

---

Top Contributors

[![Jeroen-G](https://avatars.githubusercontent.com/u/1116853?v=4)](https://github.com/Jeroen-G "Jeroen-G (15 commits)")

---

Tags

assistancelaraveltestingtestinglaravelhelpersTestAssist

### Embed Badge

![Health badge](/badges/jeroen-g-testassist/health.svg)

```
[![Health](https://phpackages.com/badges/jeroen-g-testassist/health.svg)](https://phpackages.com/packages/jeroen-g-testassist)
```

###  Alternatives

[laracasts/testdummy

Easy test stubs

4671.4M36](/packages/laracasts-testdummy)[illuminated/testing-tools

Laravel-specific Testing Helpers and Assertions.

5420.4k17](/packages/illuminated-testing-tools)[davestewart/sketchpad

An innovative front-end environment for interactive Laravel development

29512.9k1](/packages/davestewart-sketchpad)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[hyvor/laravel-playwright

Laravel and Playwright E2E Testing

3312.0k](/packages/hyvor-laravel-playwright)[srlabs/laravel-testing-utilities

Helper utilities for testing Laravel Applications

1011.9k](/packages/srlabs-laravel-testing-utilities)

PHPackages © 2026

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