From: Andrey Kutejko Date: Sat, 10 Aug 2013 13:58:29 +0000 (+0300) Subject: date format utilities X-Git-Tag: 0.5~76 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=720eee84291a8a52f08a7dd237c35515711da949;p=ipf.git date format utilities --- diff --git a/ipf/format.php b/ipf/format.php new file mode 100644 index 0000000..77c5041 --- /dev/null +++ b/ipf/format.php @@ -0,0 +1,108 @@ +assertEquals(IPF_Format::DATE_ISO8601, IPF_Format::DATE_BIG_ENDIAN | IPF_Format::DATE_HYPHENS); + $this->assertEquals(IPF_Format::DATE_US, IPF_Format::DATE_MIDDLE_ENDIAN | IPF_Format::DATE_SLASHES); + $this->assertEquals(IPF_Format::DATE_EUROPEAN, IPF_Format::DATE_LITTLE_ENDIAN | IPF_Format::DATE_DOTS); + } + + public function testFlagsFromString() + { + $this->assertEquals(IPF_Format::DATE_ISO8601, IPF_Format::flagsFromString('iso8601')); + $this->assertEquals(IPF_Format::DATE_ISO8601, IPF_Format::flagsFromString('Big-endian with hyphEns')); + $this->assertEquals(IPF_Format::DATE_EUROPEAN, IPF_Format::flagsFromString('European')); + $this->assertEquals(IPF_Format::DATE_EUROPEAN, IPF_Format::flagsFromString('little-endian with dots')); + $this->assertEquals(IPF_Format::DATE_US, IPF_Format::flagsFromString('US')); + $this->assertEquals(IPF_Format::DATE_US, IPF_Format::flagsFromString('Middle-Endian With Slashes')); + $this->assertEquals(IPF_Format::DATE_BIG_ENDIAN | IPF_Format::DATE_SPACES, + IPF_Format::flagsFromString('big-endian with spaces')); + } +} +