Commit 57b4a9cd authored by Matthias Larisch's avatar Matthias Larisch

Fix sleep mode does not handle NULL values

parent b8b65422
Pipeline #10630419 failed with stage
in 3 minutes and 21 seconds
......@@ -18,9 +18,17 @@ class SettingsView extends View
if($sleep['sleep_status'] == 1)
{
$date = DateTime::createFromFormat('Y-m-d', $sleep['sleep_from']);
if($date === false)
{
$date = new DateTime();
}
$from = $date->format('d.m.Y');
$date = DateTime::createFromFormat('Y-m-d', $sleep['sleep_until']);
if($date === false)
{
$date = new DateTime();
}
$to = $date->format('d.m.Y');
addJs("
......
<?php
namespace api;
class ChangeSleepmodeCest
{
//https://foodsharing.de/?page=settings&sub=sleeping
public function pageDisplaysWithNullValues(\ApiTester $I)
{
$user = $I->createFoodsaver(null, array('sleep_from' => null, 'sleep_status' => 1));
$I->login($user['email']);
$request = array('page' => 'settings',
'sub' => 'sleeping');
$I->sendGET('/', $request);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment