Skip to content

Commit

Permalink
fix some broken tests on spaces (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
TalysonSoares authored Jun 24, 2024
1 parent f1898c1 commit 7d8f10d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
13 changes: 9 additions & 4 deletions app/tests/Functional/SpaceApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,29 @@ public function testGetOneSpaceShouldRetrieveAObject(): void

public function testCreateSpaceShouldReturnCreatedSpace(): void
{
$this->markTestSkipped();
$spaceTestFixtures = SpaceTestFixtures::partial();

$response = $this->client->request(Request::METHOD_POST, self::BASE_URL, [
'body' => $spaceTestFixtures->json(),
]);

$content = json_decode($response->getContent(), true);

$this->assertEquals(Response::HTTP_CREATED, $response->getStatusCode());
$this->assertIsArray($content);

foreach ($spaceTestFixtures->toArray() as $key => $value) {
if ('type' === $key) {
$this->assertEquals($value, $content[$key]['id']);
continue;
}

$this->assertEquals($value, $content[$key]);
}
}

public function testDeleteSpaceShouldReturnSuccess(): void
{
$this->markTestSkipped();
$response = $this->client->request(Request::METHOD_DELETE, self::BASE_URL.'/1');

$this->assertEquals(Response::HTTP_NO_CONTENT, $response->getStatusCode());
Expand All @@ -60,9 +65,8 @@ public function testDeleteSpaceShouldReturnSuccess(): void
$this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
}

public function testUpdate(): void
public function testUpdateSpaceShouldReturnUpdatedSpace(): void
{
$this->markTestSkipped();
$spaceTestFixtures = SpaceTestFixtures::partial();
$url = sprintf(self::BASE_URL.'/%s', SpaceFixtures::SPACE_ID_3);

Expand All @@ -73,6 +77,7 @@ public function testUpdate(): void
$content = json_decode($response->getContent(), true);
$this->assertEquals(Response::HTTP_CREATED, $response->getStatusCode());
$this->assertIsArray($content);

foreach ($spaceTestFixtures->toArray() as $key => $value) {
$this->assertEquals($value, $content[$key]);
}
Expand Down
32 changes: 6 additions & 26 deletions app/tests/fixtures/SpaceTestFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,13 @@ final class SpaceTestFixtures extends AbstractTestFixtures implements TestFixtur
public static function partial(): self
{
return new self([
'location' => [
'latitude' => '10',
'longitude' => '10',
'name' => 'Secretaria da Cultura do Estado do Ceará - SECULT',
'type' => 41,
'shortDescription' => 'A Secretaria da Cultura do Estado do Ceará (Secult) foi criada pela Lei nº 8.541, de 9 de agosto de 1966, durante o governo de Virgílio Távora. A Secult tem como missão executar, superintender e coordenar as atividades de proteção do patrimônio cultural do Ceará, difusão da cultura e aprimoramento cultural do povo cearense.',
'terms' => [
'tag' => [],
'area' => ['Gestão Cultural'],
],
'name' => 'Espaço da Cultura',
'public' => true,
'shortDescription' => 'Um ponto de encontro para compartilhar cultura.',
'longDescription' => 'Portal que nos transporta para o coração pulsante da rica cultura do brasileiro.',
'emailPublico' => '[email protected]',
'emailPrivado' => '[email protected]',
'cnpj' => '00.000.000/0000-00',
'razaoSocial' => 'Centro Cultural Test',
'telefonePublico' => '0000-0000',
'telefone1' => '0000-0000',
'telefone2' => '0000-0000',
'acessibilidade' => 'Sim',
'acessibilidade_fisica' => ['Banheiros adaptados', 'Bebedouro adaptado', 'Circuito de visitação adaptado', 'Rampa de acesso', 'Sanitário adaptado'],
'capacidade' => 20,
'endereco' => 'Test',
'En_CEP' => '80000',
'En_Nome_Logradouro' => 'Rua test',
'En_Num' => '1234',
'En_Complemento' => 'Test',
'En_Bairro' => 'Test',
'En_Municipio' => 'Test',
'En_Estado' => 'CE',
'horario' => '7:00 - 22:00',
]);
}

Expand Down

0 comments on commit 7d8f10d

Please sign in to comment.