Guest User

Untitled

a guest
May 23rd, 2020
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1.     /** @test */
  2.     public function endpoint_shouldReturn200()
  3.     {
  4.         factory(User::class)->create([
  5.             'email' => 'unique@email.com',
  6.             'password' => bcrypt('password')
  7.         ]);
  8.  
  9.         $response = $this->postJson(
  10.             '/api/auth/tokens',
  11.             [
  12.                 'email' => 'unique@email.com',
  13.                 'password' => 'password',
  14.                 'device_name' => 'ios'
  15.             ]
  16.         ); // Issuing a token, expecting 201
  17.  
  18.         $response->assertStatus(201);
  19.  
  20.         $token = $response->getData()->data->token;
  21.  
  22.         $response = $this->deleteJson(
  23.             '/api/auth/tokens',
  24.             [],
  25.             [
  26.                 'Authorization' => "Bearer $token"
  27.             ]
  28.         );
  29.  
  30.         $response->assertStatus(200);
  31.         $response->assertExactJson([
  32.             'message' => null,
  33.             'data' => null
  34.         ]);
  35.     }
Add Comment
Please, Sign In to add comment