pbmedia/laravel-browser-kit-macro

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

5.6.0 2024-03-12 11:46 UTC

README

Latest Version on Packagist Software License Quality Score Total Downloads

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

Requirements

  • Laravel 10
  • PHP 8.2 or higher

Sponsor this package!

❤️ We proudly support the community by developing Laravel packages and giving them away for free. If this package saves you time or if you're relying on it professionally, please consider sponsoring the maintenance and development. Keeping track of issues and pull requests takes time, but we're happy to help!

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:

ProtoneMedia\LaravelBrowserKitMacro\BrowserKitMacroServiceProvider::class,

Upgrading to v5

  • The namespace has changed to ProtoneMedia\LaravelBrowserKitMacro. Please update your code accordingly.

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

Other Laravel packages

  • Laravel Blade On Demand: Laravel package to compile Blade templates in memory.
  • Laravel Cross Eloquent Search: Laravel package to search through multiple Eloquent models.
  • Laravel Eloquent Scope as Select: Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.
  • Laravel FFMpeg: This package provides an integration with FFmpeg for Laravel. The storage of the files is handled by Laravel's Filesystem.
  • Laravel MinIO Testing Tools: Run your tests against a MinIO S3 server.
  • Laravel Mixins: A collection of Laravel goodies.
  • Laravel Paddle: Paddle.com API integration for Laravel with support for webhooks/events.
  • Laravel Task Runner: Write Shell scripts like Blade Components and run them locally or on a remote server.
  • Laravel Verify New Email: This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.
  • Laravel XSS Protection: Laravel Middleware to protect your app against Cross-site scripting (XSS). It sanitizes request input, and it can sanatize Blade echo statements.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

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