public function testEnsure12PMisNoon() { $format = TimeParser::FORMAT24; TimeParser::setFormat($format); $expected = Carbon::now()->hour(12)->minute(0)->format($format); $actual = TimeParser::parse("12pm"); $this->assertEquals($expected, $actual); }
public function testFormat24() { $format = TimeParser::FORMAT24; TimeParser::setFormat($format); $expected = Carbon::now()->hour(11)->minute(22)->second(33)->format($format); $actual = TimeParser::parse("11:22:33"); $this->assertEquals($expected, $actual); }
public function testSeconds() { $format = TimeParser::FORMAT12SEC; TimeParser::setFormat($format); $expected = Carbon::now()->hour(20)->minute(18)->second(16)->format($format); $actual = TimeParser::parse("20:18:16"); $this->assertEquals($expected, $actual); $actual = TimeParser::parse("20.18.16"); $this->assertEquals($expected, $actual); $actual = TimeParser::parse("201816"); $this->assertEquals($expected, $actual); }
/** * @expectedException Valorin\TimeParser\TimeParserException */ public function testTooHighMinutes() { TimeParser::parse("12:69"); }