Add post with invalid token test
This commit is contained in:
@@ -53,6 +53,8 @@ class CreateTest extends ApiTestCase
|
||||
return json_decode($client->getResponse()->getContent(), true)['token'];
|
||||
}
|
||||
|
||||
// TESTS
|
||||
|
||||
public function testPostWithValidToken(): void
|
||||
{
|
||||
$client = static::createClient();
|
||||
@@ -97,4 +99,25 @@ class CreateTest extends ApiTestCase
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
public function testPostWithInvalidToken()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$client->request(
|
||||
'POST',
|
||||
'/v4/projects',
|
||||
[
|
||||
'headers' => [
|
||||
'Authorization' => "Bearer invalid_token",
|
||||
'Content-Type' => 'application/json',
|
||||
],
|
||||
'json' => [
|
||||
'title' => 'ProjectApiTest Project',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user