fromString() public static method

Creates a new interval from time strings.
public static fromString ( string $startTime, string $endTime ) : TimeInterval
$startTime string The start time
$endTime string The end time
return TimeInterval
Exemplo n.º 1
0
 public function testContains()
 {
     $interval = TimeInterval::fromString('08:00', '18:30');
     $this->assertTrue($interval->contains(new Time('08', '00')));
     $this->assertTrue($interval->contains(new Time('18', '30')));
     $this->assertTrue($interval->contains(new Time('09', '00')));
     $this->assertFalse($interval->contains(new Time('07', '59')));
     $this->assertFalse($interval->contains(new Time('18', '31')));
 }
Exemplo n.º 2
0
 public function testJsonSerialize()
 {
     $interval = TimeInterval::fromString('08:00:01', '18:30:02');
     $this->assertJsonStringEqualsJsonFile(__DIR__ . '/Expected/TimeInterval/testJsonSerialize.json', json_encode($interval));
 }