Skip to content

Commit

Permalink
add test for api-platform/core#6313
Browse files Browse the repository at this point in the history
  • Loading branch information
usu committed Apr 20, 2024
1 parent 8c5cc9f commit e82b462
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/tests/Api/Camps/ReadCampTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testGetSingleCampIsAllowedForGuest() {
/** @var Camp $camp */
$camp = static::getFixture('camp1');
$user = static::getFixture('user3guest');
static::createClientWithCredentials(['email' => $user->getEmail()])->request('GET', '/camps/'.$camp->getId());
$response = static::createClientWithCredentials(['email' => $user->getEmail()])->request('GET', '/camps/'.$camp->getId());
$this->assertResponseStatusCodeSame(200);
$this->assertJsonContains([
'id' => $camp->getId(),
Expand All @@ -67,6 +67,12 @@ public function testGetSingleCampIsAllowedForGuest() {
'categories' => ['href' => '/categories?camp=%2Fcamps%2F'.$camp->getId()],
],
]);

$responseArray = $response->toArray();
$period1 = static::getFixture('period1');
$period2 = static::getFixture('period2');
$this->assertEquals("/periods/{$period2->getId()}/days", $responseArray['_embedded']['periods'][0]['_links']['days']['href']);
$this->assertEquals("/periods/{$period1->getId()}/days", $responseArray['_embedded']['periods'][1]['_links']['days']['href']);
}

public function testGetSingleCampIsAllowedForMember() {
Expand Down

0 comments on commit e82b462

Please sign in to comment.