View on GitHub

NovaUnit

Unit testing suite for Laravel Nova, built to extend PHPUnit

NovaUnit is a unit-testing package for Laravel Nova, built using PHPUnit. NovaUnit provides you with assertions for Nova Actions, Filters, Lenses and Resources, so you can create great administration panels with confidence.

Installation

You can install this package into your Laravel project via composer:

composer require --dev joshgaber/novaunit

Requirements

Usage

NovaUnit can be used to perform assertions on Actions, Filters, Lenses and Resources.

To access the test classes, import and use the base test traits:

class ClearLogsTest extends TestCase {
    use NovaActionTest;
}

Currently, there are four traits: NovaActionTest, NovaFilterTest, NovaLensTest and NovaResourceTest. To test these components, invoke the respective test class (ie. novaAction for Actions).

Once you’ve created the mock with the initial test class, you can begin testing different aspect of the component:

$this->novaAction(ClearLogs::class)
    ->assertHasField('since_date');

Available Methods