PHPackages                             aliameen/laravel-test-helpers - 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. aliameen/laravel-test-helpers

ActiveLibrary

aliameen/laravel-test-helpers
=============================

PHPUnit testing helpers for Laravel - simplify mocking

v1.0.0(3mo ago)00MITPHPPHP ^7.2|^8.0|^8.1|^8.2

Since Feb 16Pushed 3mo agoCompare

[ Source](https://github.com/aliameen91/laravel-test-helpers)[ Packagist](https://packagist.org/packages/aliameen/laravel-test-helpers)[ RSS](/packages/aliameen-laravel-test-helpers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Laravel Test Helpers
====================

[](#laravel-test-helpers)

PHPUnit testing helpers for Laravel. Stop writing repetitive mocking code.

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

[](#installation)

```
composer require aliameen/laravel-test-helpers --dev
```

Usage
-----

[](#usage)

Add the trait to your test:

```
use AliAmeen\LaravelTestHelpers\TestHelpers;

class MyTest extends TestCase
{
    use TestHelpers;
}
```

Methods
-------

[](#methods)

### Mock Request

[](#mock-request)

```
$this->getRequestMockWith([
    'email' => 'test@example.com',
    'name' => 'John'
]);

// $request->input('email') returns 'test@example.com'
```

### Mock Services

[](#mock-services)

```
$this->mockClassWith(UserService::class, [
    'findById' => $user,
    'isActive' => true
]);

// app(UserService::class)->findById(1) returns $user
```

### Fluent Mocking

[](#fluent-mocking)

```
$this->mockClassWith(Builder::class, [
    'setName' => 'SELF_OBJECT_RETURN',
    'save' => true
]);

// $builder->setName('x')->save() works
```

### Other Helpers

[](#other-helpers)

```
// Set private properties
$this->setPrivateProperty($object, MyClass::class, 'prop', 'value');

// Compare arrays (ignore key order)
$this->assertArraySimilar($expected, $actual);

// Parse JSON response
$data = $this->parsedJsonResponse();
```

Requirements
------------

[](#requirements)

- PHP 7.2+
- Laravel 5.8+

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/55d6a821ee443ba47b5c3ee432a9855d39780dde214b0257fe8b1cab5f7cb903?d=identicon)[aliameen91](/maintainers/aliameen91)

---

Top Contributors

[![aliameen91](https://avatars.githubusercontent.com/u/16963915?v=4)](https://github.com/aliameen91 "aliameen91 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aliameen-laravel-test-helpers/health.svg)

```
[![Health](https://phpackages.com/badges/aliameen-laravel-test-helpers/health.svg)](https://phpackages.com/packages/aliameen-laravel-test-helpers)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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