PHPackages                             smartymoon/inertia-laravel-testing - 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. smartymoon/inertia-laravel-testing

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

smartymoon/inertia-laravel-testing
==================================

Testing helpers for https://github.com/inertiajs/inertia-laravel

0131PHP

Since May 3Pushed 5y agoCompare

[ Source](https://github.com/smartymoon/inertia-laravel-testing)[ Packagist](https://packagist.org/packages/smartymoon/inertia-laravel-testing)[ RSS](/packages/smartymoon-inertia-laravel-testing/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

[inertiajs/inertia-laravel](https://github.com/inertiajs/inertia-laravel) Testing Helpers
=========================================================================================

[](#inertiajsinertia-laravel-testing-helpers)

> **NOTE**: This package WILL be deprecated once ANY official testing helpers become available in [inertiajs/inertia-laravel](https://github.com/inertiajs/inertia-laravel). The package WILL stay available for install, but WILL NOT receive any further (security) updates from that point forward.

[![Latest Version](https://camo.githubusercontent.com/9a3a2595acc3fa00be4e400666a92cce65ef0c4d904494c3f4fbe7b0dbc9112e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636c617564696f64656b6b65722f696e65727469612d6c61726176656c2d74657374696e672e7376673f7374796c653d666c61742d737175617265)](https://github.com/claudiodekker/inertia-laravel-testing/releases)[![Build Status](https://camo.githubusercontent.com/e91fe01bb6ff753040babd396953c74656fd9fd9302056899c9a5bf6a37d55e9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636c617564696f64656b6b65722f696e65727469612d6c61726176656c2d74657374696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/claudiodekker/inertia-laravel-testing)[![Quality Score](https://camo.githubusercontent.com/a283fb25704b554387c6c14d02073f9a823854d8da9fbb5650dbf037f24372bc/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636c617564696f64656b6b65722f696e65727469612d6c61726176656c2d74657374696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/claudiodekker/inertia-laravel-testing)[![StyleCI](https://camo.githubusercontent.com/b1995146fd8e085cc1e82224a7e35883d2a655c183fd224daafe951824e8b7c8/68747470733a2f2f7374796c6563692e696f2f7265706f732f3239323532363534372f736869656c64)](https://styleci.io/repos/292526547)[![Total Downloads](https://camo.githubusercontent.com/457ea92c4f66fef889535cd9e70c50f0c3cd210a746afe0bd2f8c33e7d125a8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c617564696f64656b6b65722f696e65727469612d6c61726176656c2d74657374696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/claudiodekker/inertia-laravel-testing)

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

[](#installation)

You can install the package via composer:

```
composer require --dev claudiodekker/inertia-laravel-testing
```

Usage
-----

[](#usage)

To test, simply chain any of the following methods onto your `TestResponse` responses.

[![Screenshot 2020-09-02 at 19 44 39](https://user-images.githubusercontent.com/1752195/92017928-c10b4b00-ed54-11ea-95b4-ccff11d89d06.png)](https://user-images.githubusercontent.com/1752195/92017928-c10b4b00-ed54-11ea-95b4-ccff11d89d06.png)

Available Methods
-----------------

[](#available-methods)

The methods made available in this package closely reflect those available in Laravel itself:

Assert whether the given page is an Inertia-rendered view

```
$response->assertInertia();

// or, also check whether the page is a specific component
$response->assertInertia('example');

// or, also check whether all of the given props match
$response->assertInertia('example', [
    'foo' => 'bar'
]);
```

Return all available Inertia props for the page, or only retrieve a specific one

```
$response->inertiaProps();

// Retrieve a specific (nested) prop. Returns `null` if the prop doesn't exist.
$response->inertiaProps('nested.prop');
```

Assert whether the Inertia-rendered view has a specific property set

```
$response->assertInertiaHas('key');

// or, against deeply nested values
$response->assertInertiaHas('deeply.nested.key');
```

Apart from checking whether the property is set, the same method can be used to assert that the values match

```
$response->assertInertiaHas('key', 'matches-this-value');

// or, for deeply nested values
$response->assertInertiaHas('deeply.nested.key', 'also-match-against-this-value');
```

It's also possible to assert directly against a Laravel Model (or any other `Arrayable` or `Responsable` class)

```
$user = UserFactory::new()->create(['name' => 'John Doe']);

// ... (Make HTTP request etc.)

$response->assertInertiaHas('user', $user);
$response->assertInertiaHas('deeply.nested.user', $user);
```

It's also possible to check against a closure

```
$response->assertInertiaHas('foo', function ($value) {
    return $value === 'bar';
});

// or, again, for deeply nested values
$response->assertInertiaHas('deeply.nested.foo', function ($value) {
    return $value === 'bar';
});
```

Next, you can also check against a whole array of properties. It'll simply loop over them using the `assertInertiaHas` method described above:

```
$response->assertInertiaHasAll([
    'foo',
    'bar.baz',
    'another.nested.key' => 'example-value'
]);
```

Finally, you can assert that a property was not set:

```
$response->assertInertiaMissing('key');

// or, for deeply nested values
$response->assertInertiaMissing('deeply.nested.key');
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd493ffaf9d1e67a7dfda20bed96387a51a3ad8c099e837b20d92d96925a9f08?d=identicon)[smartymoon](/maintainers/smartymoon)

---

Top Contributors

[![smartymoon](https://avatars.githubusercontent.com/u/12489528?v=4)](https://github.com/smartymoon "smartymoon (1 commits)")

### Embed Badge

![Health badge](/badges/smartymoon-inertia-laravel-testing/health.svg)

```
[![Health](https://phpackages.com/badges/smartymoon-inertia-laravel-testing/health.svg)](https://phpackages.com/packages/smartymoon-inertia-laravel-testing)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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