项目作者: rymanalu

项目描述 :
Laravel Dusk for Sentinel
高级语言: PHP
项目地址: git://github.com/rymanalu/dusk-for-sentinel.git
创建时间: 2017-06-02T16:40:56Z
项目社区:https://github.com/rymanalu/dusk-for-sentinel

开源协议:MIT License

下载


Laravel Dusk for Sentinel

Build Status

This package override the routes that used by loginAs method in Laravel Dusk so it can be used for Laravel project who using the Sentinel package for the authentication, since the default implementation of that method is using the Laravel Authentication service.

Installation

First, install this package via the Composer package manager:

  1. composer require rymanalu/dusk-for-sentinel

It is fine if you already install the Laravel Dusk before or only install this package.

Register the Rymanalu\DuskForSentinel\DuskForSentinelServiceProvider in your AppServiceProvider. If you already register the Laravel\Dusk\DuskServiceProvider, just replace it to this provider:

  1. use Rymanalu\DuskForSentinel\DuskForSentinelServiceProvider;
  2. /**
  3. * Register any application services.
  4. *
  5. * @return void
  6. */
  7. public function register()
  8. {
  9. if ($this->app->environment('local', 'testing')) {
  10. $this->app->register(DuskForSentinelServiceProvider::class);
  11. }
  12. }

You may run php artisan dusk:install if you haven’t already publish the Dusk package or you can check out the documentation for further Dusk configuration.

Usage

So now, you can authenticate the Sentinel User object with the loginAs method in your browser test script:

  1. $this->browse(function (Browser $browser) {
  2. $browser->loginAs(Sentinel::findById(1))
  3. ->visit('/home');
  4. });