Skip to content

Commit

Permalink
fix(ZMS-3253): try fixing availability mockdata for testRendering
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 d65ccb8 commit 3fa84a1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
25 changes: 20 additions & 5 deletions zmsapi/tests/Zmsapi/AvailabilityAddTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,47 @@ class AvailabilityAddTest extends Base
{
protected $classname = "AvailabilityAdd";


public function testRendering()
{
$this->setWorkstation();

$response = $this->render([], [
'__body' => json_encode([
'availabilityList' => [
[
"id" => 21202,
"description" => "Test Öffnungszeit update",
"scope" => ["id" => 312]
"startDate" => time() + (2 * 24 * 60 * 60), // 2 days in the future
"endDate" => time() + (5 * 24 * 60 * 60), // 5 days in the future
"startTime" => "09:00:00",
"endTime" => "17:00:00",
"kind" => "default",
"scope" => [
"id" => 312
]
],
[
"description" => "Test Öffnungszeit ohne id",
"scope" => ["id" => 141]
"startDate" => time() + (1 * 24 * 60 * 60), // 1 day in the future
"endDate" => time() + (4 * 24 * 60 * 60), // 4 days in the future
"startTime" => "10:00:00",
"endTime" => "16:30:00",
"kind" => "default",
"scope" => [
"id" => 141
]
]
],
'selectedDate' => '2024-11-15'
'selectedDate' => date('Y-m-d')
])
], []);

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


public function testEmpty()
{
$this->setWorkstation();
Expand Down
11 changes: 10 additions & 1 deletion zmsapi/tests/Zmsapi/AvailabilityUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public function testRendering()
$currentTimestamp = time();
$input['startDate'] = $currentTimestamp + (2 * 24 * 60 * 60); // 2 days in the future
$input['endDate'] = $currentTimestamp + (5 * 24 * 60 * 60); // 5 days in the future
$input['startTime'] = "09:00:00";
$input['endTime'] = "17:00:00";
$input['scope'] = ["id" => 312];
$input['kind'] = "default";

$entity = (new Query())->writeEntity($input);
error_log(json_encode($entity));
Expand All @@ -29,7 +33,12 @@ public function testRendering()
'availabilityList' => [
[
"id" => $entity->getId(),
"description" => "",
"description" => "Updated availability",
"startDate" => $input['startDate'],
"endDate" => $input['endDate'],
"startTime" => $input['startTime'],
"endTime" => $input['endTime'],
"kind" => $input['kind'],
"scope" => ["id" => 312]
]
],
Expand Down

0 comments on commit 3fa84a1

Please sign in to comment.