Skip to content

Instantly share code, notes, and snippets.

@nasrulhazim
Last active April 14, 2020 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasrulhazim/1a0de28fb19a6caabc79676ce65c20c1 to your computer and use it in GitHub Desktop.
Save nasrulhazim/1a0de28fb19a6caabc79676ce65c20c1 to your computer and use it in GitHub Desktop.
Learn Middleware Test
<?php
namespace Tests\Feature;
use App\Http\Middleware\LearnUnitTestMiddleware;
use Tests\TestCase;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Mockery;
class LearnMiddlewareTest extends TestCase
{
/** @test */
public function the_learn_middleware_works()
{
$this->app['router']->get('test-middleware', function (\Illuminate\Http\Request $request) {
$this->assertContains(['learn' => true], $request->input());
})->middleware('App\Http\Middleware\LearnUnitTestMiddleware');
$this->get('test-middleware');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment