Skip to content

Instantly share code, notes, and snippets.

@jonnybarnes
Created March 18, 2016 14:29
Show Gist options
  • Save jonnybarnes/0dce2f0aec1c67fe4e55 to your computer and use it in GitHub Desktop.
Save jonnybarnes/0dce2f0aec1c67fe4e55 to your computer and use it in GitHub Desktop.
Cookie test
<?php
namespace App\Tests;
use TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
public function testCookies()
{
$response = $this->call(
'GET',
'/cookies',
[/* parameters */],
['hello' => 'world']
);
var_dump($response);
}
}
<?php
Route::group(['middleware' => 'web'], function () {
Route::get('/real/route', 'ProperController@iWantToTest');
Route::get('/cookies', function () {
return 'Cookie: ' . Request::cookie('hello');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment