Skip to content

Commit

Permalink
Tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasHermanek committed Nov 19, 2024
1 parent d275437 commit 08f79f0
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions tests/Controller/Api/Adm/V1/KeywordControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ public function testCreateFailure(array $requestJson, array $validationErrors):

public function createFailureDataProvider(): array
{
$existingKeyword = self::getContainer()
->get(KeywordRepository::class)
->find(KeywordFixtures::KEYWORD_1);

return [
[
'requestJson' => [
Expand All @@ -134,17 +130,33 @@ public function createFailureDataProvider(): array
ValidationException::ERROR_FIELD_EMPTY,
],
],
],
]
];
}

/**
* @dataProvider keywordExistsDataProvider
*/
public function testKeywordExists(array $requestJson): void
{
$client = $this->getApiClient(User::ID_ADMIN);

$response = $client->post(KeywordUrl::createPath(), $requestJson);
$this->assertSame(Response::HTTP_OK, $response->getStatusCode());
}

public function keywordExistsDataProvider(): array
{
$existingKeyword = self::getContainer()
->get(KeywordRepository::class)
->find(KeywordFixtures::KEYWORD_1);

return [
[
'requestJson' => [
'name' => $existingKeyword->getName(),
'extSystem' => ExtSystemFixtures::ID_CMS,
],
'validationErrors' => [
'name' => [
ValidationException::ERROR_FIELD_UNIQUE,
]
],
]
],
];
}
Expand Down

0 comments on commit 08f79f0

Please sign in to comment.