create(); $token = $user->createToken('New'); $response = $this->withHeaders([ 'Authorization' => 'Bearer ' . $token->plainTextToken, ])->json('GET', '/api/v1/api-token-details'); $response->assertSuccessful(); $this->assertEquals($token->accessToken->name, $response->json()['name']); $this->assertEquals($token->accessToken->created_at, $response->json()['created_at']); $this->assertEquals($token->accessToken->expires_at, $response->json()['expires_at']); } }