pbmedia/laravel-browser-kit-macro

A macro to use the Laravel 5.3 testing layer inside your Laravel 5.4+ tests

4.0.0 2019-02-27 19:52 UTC

README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

This package allows you to seamlessly use the Browser Kit features in more modern Laravel installations.

Requirements

  • Laravel 5.8 only, use v1.0 for Laravel 5.4 and 5.5, use v2.0 for Laravel 5.6, use v3.0 for Laravel 5.7.
  • PHP 7.1, 7.2 and 7.3 supported.
  • Support for Package Discovery.

Installation

You can install the package via composer:

composer require pbmedia/laravel-browser-kit-macro --dev

If you're not using Package Discovery, add the Service Provider to your config/app.php file:

Pbmedia\LaravelBrowserKitMacro\BrowserKitMacroServiceProvider::class,

Usage

This package adds a browserKit method to the TestResponse class. It accepts a Closure which receives the Browser Kit TestCase as its first argument.

/** @test */
public function it_presents_a_registration_form()
{
    $this->get('register')
        ->assertStatus(200)
        ->browserKit(function ($test) {
            $test->seeElement('input', ['name' => 'email']);
        });
}

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.