Add post with invalid deadline test
This commit is contained in:
@@ -123,18 +123,20 @@ class CreateTest extends ApiTestCase
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
|
||||
public function testPostWithInvalidInput(): void
|
||||
private function testPostWithInvalidInput(array $invalidData): void
|
||||
{
|
||||
$requestData = [
|
||||
'title' => 'New Education Project',
|
||||
'subtitle' => 'Education for the Future',
|
||||
'category' => 'nonexistent-category', // invalid category
|
||||
'category' => 'education',
|
||||
'territory' => ['country' => 'ES'],
|
||||
'description' => 'Detailed project description',
|
||||
'deadline' => 'minimum',
|
||||
'video' => 'https://www.youtube.com/watch?v=bnrVQHEXmOk',
|
||||
];
|
||||
|
||||
$requestData = array_merge($requestData, $invalidData);
|
||||
|
||||
$client = static::createClient();
|
||||
$client->request('POST', self::POST_URL, [
|
||||
'headers' => $this->getHeaders($client),
|
||||
@@ -144,6 +146,14 @@ class CreateTest extends ApiTestCase
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
public function testPostWithInvalidCategory() : void {
|
||||
$this->testPostWithInvalidInput(['category' => 'nonexistent-category']);
|
||||
}
|
||||
|
||||
public function testPostWithInvalidDeadline() : void {
|
||||
$this->testPostWithInvalidInput(['deadline' => 'extended']);
|
||||
}
|
||||
|
||||
public function testPostUnauthorized()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
Reference in New Issue
Block a user