From 720eee84291a8a52f08a7dd237c35515711da949 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 10 Aug 2013 16:58:29 +0300 Subject: [PATCH] date format utilities --- ipf/format.php | 108 +++++++++++++++++++++++++++++++++++++++++++++++ t/FormatTest.php | 24 +++++++++++ 2 files changed, 132 insertions(+) create mode 100644 ipf/format.php create mode 100644 t/FormatTest.php 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')); + } +} + -- 2.49.0