Jyxo\Time\ComposerTest::testValidDates PHP Method

testValidDates() public method

Tests valid date.
public testValidDates ( )
    public function testValidDates()
    {
        $composer = new Composer();
        $tests = ['2002-04-30 00:00:00', '2003-02-28 00:00:00', '2004-02-29 05:03:16', '2005-07-31 01:01:01', '2006-10-31 23:59:59', '2007-11-30 15:16:17'];
        foreach ($tests as $test) {
            preg_match('~^(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})$~', $test, $matches);
            $composer->setDay((int) $matches[3])->setMonth((int) $matches[2])->setYear((int) $matches[1])->setHour((int) $matches[4])->setMinute((int) $matches[5])->setSecond((int) $matches[6]);
            $time = $composer->getTime();
            $this->assertEquals(new Time($test), $time, sprintf('Failed test for %s.', $test));
        }
    }