user = factory(User::class)->create(); $this->withoutExceptionHandling(); } /** @test */ // public function authenticate() // { // $this->postJson('/api/login', [ // 'email' => $this->user->email, // 'password' => 'secret', // ]) // ->assertSuccessful() // ->assertJsonStructure(['token', 'expires_in']) // ->assertJson(['token_type' => 'bearer']); // } /** @test */ public function fetch_the_current_user() { $this->actingAs($this->user) ->getJson('/api/user') ->assertSuccessful() ->assertJsonStructure(['id', 'name', 'email', 'marking']); } /** @test */ // public function log_out() // { // $token = $this->postJson('/api/login', [ // 'email' => $this->user->email, // 'password' => 'secret', // ])->json()['token']; // $this->postJson("/api/logout?token=$token") // ->assertSuccessful(); // $this->getJson("/api/user?token=$token") // ->assertStatus(401); // } }