IcingaTimePeriodTest: stricter tests
This commit is contained in:
parent
0ba23e8b4a
commit
3970f381dd
|
@ -2,16 +2,14 @@
|
||||||
|
|
||||||
namespace Tests\Icinga\Module\Director\Objects;
|
namespace Tests\Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
use Icinga\Module\Director\Objects\IcingaTimePeriodRange;
|
|
||||||
use Icinga\Module\Director\Objects\IcingaTimePeriodRanges;
|
|
||||||
use Icinga\Module\Director\Objects\IcingaTimePeriod;
|
use Icinga\Module\Director\Objects\IcingaTimePeriod;
|
||||||
use Icinga\Module\Director\Test\BaseTestCase;
|
use Icinga\Module\Director\Test\BaseTestCase;
|
||||||
|
|
||||||
class IcingaTimePeriodRangesTest extends BaseTestCase
|
class IcingaTimePeriodTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
protected $testPeriodName = '___TEST___timerange';
|
protected $testPeriodName = '___TEST___timeperiod';
|
||||||
|
|
||||||
public function testWhetherUpdatedTimeperiodRangesAreCorrectlyStored()
|
public function testWhetherUpdatedTimeperiodsAreCorrectlyStored()
|
||||||
{
|
{
|
||||||
if ($this->skipForMissingDb()) {
|
if ($this->skipForMissingDb()) {
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +22,12 @@ class IcingaTimePeriodRangesTest extends BaseTestCase
|
||||||
'tuesday' => '18:00-24:00',
|
'tuesday' => '18:00-24:00',
|
||||||
'wednesday' => '00:00-24:00',
|
'wednesday' => '00:00-24:00',
|
||||||
);
|
);
|
||||||
$period->ranges()->set($newRanges);
|
$period->ranges = $newRanges;
|
||||||
|
$this->assertEquals(
|
||||||
|
'18:00-24:00',
|
||||||
|
$period->toPlainObject()->ranges->tuesday
|
||||||
|
);
|
||||||
|
|
||||||
$period->store();
|
$period->store();
|
||||||
|
|
||||||
$period = $this->loadTestPeriod();
|
$period = $this->loadTestPeriod();
|
||||||
|
@ -32,6 +35,23 @@ class IcingaTimePeriodRangesTest extends BaseTestCase
|
||||||
'18:00-24:00',
|
'18:00-24:00',
|
||||||
$period->ranges()->get('tuesday')->timeperiod_value
|
$period->ranges()->get('tuesday')->timeperiod_value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'00:00-24:00',
|
||||||
|
$period->toPlainObject()->ranges->wednesday
|
||||||
|
);
|
||||||
|
|
||||||
|
$period->ranges()->setRange('wednesday', '09:00-17:00');
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'09:00-17:00',
|
||||||
|
$period->toPlainObject()->ranges->wednesday
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
'00:00-24:00',
|
||||||
|
$period->getPlainUnmodifiedObject()->ranges->wednesday
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createTestPeriod()
|
protected function createTestPeriod()
|
Loading…
Reference in New Issue