Files
crowd-fund-api/tests/Entity/ProjectApi/DeleteTest.php
T

51 lines
1.2 KiB
PHP

<?php
namespace App\Tests\Entity\ProjectApi;
use Symfony\Component\HttpFoundation\Response;
class DeleteTest extends BaseTest
{
protected function getMethod(): string
{
return 'DELETE';
}
// Runable Tests
public function testDeleteWithValidToken(): void
{
$this->prepareTestProject();
$client = static::createClient();
$client->request('DELETE', $this->getUri(), ['headers' => $this->getHeaders($client)]);
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);
}
public function testDeleteUnauthorized()
{
$this->prepareTestProject();
static::createClient()->request('DELETE', $this->getUri());
$this->assertResponseStatusCodeSame(Response::HTTP_INTERNAL_SERVER_ERROR);
}
public function testDeleteWithInvalidToken(): void
{
static::createClient()->request(
'DELETE',
$this->getUri(),
['headers' => ['Authorization' => 'Bearer 123']]
);
$this->assertResponseStatusCodeSame(Response::HTTP_UNAUTHORIZED);
}
public function testDeleteNotFound(): void
{
$this->testOneNotFound();
}
}