moon/fakemiddleware
FakeMiddleware
Sometimes you want to disable a middleware/route middleware when testing a controller in Laravel 5. This package simplifies the process.
Installation
composer require --dev "moon/fakemiddleware": "1.1"
Usage
Open TestCase.php, which comes with L5 by default. Locate createApplication method and initialize FakeMiddleware.
use Moon\FakeMiddleware\FakeMiddleware;
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
// This will remove ExternalOAuthVerifier and repalce auth middleware
// with a fake middleware
// function __construct(Application $app, $globalMiddlewares, $routeMiddlewares);
new FakeMiddleware($app, ['App\Http\Middleware\ExternalOAuthVerifier'], ['auth']);
return $app;
}
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
644,549,754
9,698
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
423,477,751
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
403,217,078
4,664
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.1 | >=5.4.0 | MIT | |
| 1.0 | >=5.4.0 | MIT | |
| 0.1 | >=5.4.0 | MIT | |
| 0.0.1 | >=5.4.0 | MIT |