Hi,
I'm trying to write a simple test which should make use of some session data. For a simple access controll, a guest can create an item ("Tournament") and the ID of this item is saved in the session. The user should now be able to export some data for this item. Saving the data
I am using the following code
public function test_admin_export()
{
$this->withoutExceptionHandling();
$t = factory(Tournament::class)->create();
$this->withSession(['tournament_admin' => [$t->id]])
->get('/')
->assertOk();
}
This will return in the following error:
1) Tests\Feature\TournamentsTest::test_admin_export
ErrorException: Trying to get property 'cookies' of non-object
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Session/CookieSessionHandler.php:69
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Session/Store.php:97
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Session/Store.php:87
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Session/Store.php:71
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Support/Manager.php:165
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php:45
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php:28
/Users/robin/development/projects/laravel/turnierbuddy/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithSession.php:15
/Users/robin/development/projects/laravel/turnierbuddy/tests/Feature/TournamentsTest.php:145
Line 145 is the line with withSession(...).
Any hint what is wrong here?