Skip to content

Commit

Permalink
fix(ZMS-3253): try fixing a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Fink authored and Tom Fink committed Nov 15, 2024
1 parent 8a07621 commit 7892fe0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion zmsapi/tests/Zmsapi/AvailabilityAddTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function testUpdateFailed()
$this->expectException('\BO\Zmsapi\Exception\Availability\AvailabilityUpdateFailed');
$this->expectExceptionCode(400);

// Wrap the data inside "availabilityList"
$this->render([], [
'__body' => json_encode([
'availabilityList' => [
Expand Down
30 changes: 16 additions & 14 deletions zmsapi/tests/Zmsapi/AvailabilityUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,31 @@ class AvailabilityUpdateTest extends Base
public function testRendering()
{
$input = (new Entity)->createExample();

// Dynamically adjust the endDate to be in the future

$currentTimestamp = time();
$input['startDate'] = $currentTimestamp + (2 * 24 * 60 * 60); // Set startDate to 2 days in the future
$input['endDate'] = $currentTimestamp + (5 * 24 * 60 * 60); // Set endDate to 5 days in the future



// Write the entity using the modified input
$input['startDate'] = $currentTimestamp + (2 * 24 * 60 * 60); // 2 days in the future
$input['endDate'] = $currentTimestamp + (5 * 24 * 60 * 60); // 5 days in the future

$entity = (new Query())->writeEntity($input);
error_log(json_encode($entity)); // Log for debugging
error_log(json_encode($entity));
$this->setWorkstation();
// Prepare the response and test rendering

// Wrap the data inside "availabilityList"
$response = $this->render([
"id" => $entity->getId()
], [
'__body' => json_encode([
"id" => $entity->getId(),
"description" => "",
"scope" => ["id" => 312]
'availabilityList' => [
[
"id" => $entity->getId(),
"description" => "",
"scope" => ["id" => 312]
]
],
'selectedDate' => date('Y-m-d')
])
], []);

$this->assertStringContainsString('availability.json', (string)$response->getBody());
$this->assertTrue(200 == $response->getStatusCode());
}
Expand Down

0 comments on commit 7892fe0

Please sign in to comment.