Skip to content

Commit

Permalink
fix(ZMS-3253): fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasAFink committed Nov 18, 2024
1 parent 8299246 commit 0d0bdb7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/AvailabilityUpdate.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package ZMS API
* @copyright BerlinOnline Stadtportal GmbH & Co.
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/

namespace BO\Zmsapi;
Expand Down
32 changes: 25 additions & 7 deletions zmsapi/tests/Zmsapi/AvailabilityUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,30 @@ class AvailabilityUpdateTest extends Base
public function testRendering()
{
$input = (new Entity)->createExample();

$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";


// Add day off data (this is the new part)
$input['dayoff'] = [
"sunday" => "0",
"monday" => "0",
"tuesday" => "0",
"wednesday" => "0",
"thursday" => "0",
"friday" => "0",
"saturday" => "0"
];

$entity = (new Query())->writeEntity($input);
error_log(json_encode($entity));
$this->setWorkstation();

$response = $this->render([
"id" => $entity->getId()
], [
Expand All @@ -39,18 +50,25 @@ public function testRendering()
"startTime" => "09:00:00",
"endTime" => "17:00:00",
"kind" => "default",
"scope" => [
"id" => 312
"scope" => ["id" => 312],
"dayoff" => [
"sunday" => "0",
"monday" => "0",
"tuesday" => "0",
"wednesday" => "0",
"thursday" => "0",
"friday" => "0",
"saturday" => "0"
]
]
],
'selectedDate' => date('Y-m-d')
])
], []);

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


public function testEmpty()
Expand Down

0 comments on commit 0d0bdb7

Please sign in to comment.