diff options
author | VirtualTam <virtualtam@flibidi.net> | 2015-06-27 14:57:44 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2015-07-09 00:44:19 +0200 |
commit | 9186ab95943b7c2467a0f27f30bed9db3c589b9d (patch) | |
tree | cfc8e4d2c8469ac16910c18d59a07b23d0348fbe /tests/UtilsTest.php | |
parent | 46d83c20d77276e9e94c54e31b29222f762e13dd (diff) | |
download | Shaarli-9186ab95943b7c2467a0f27f30bed9db3c589b9d.tar.gz Shaarli-9186ab95943b7c2467a0f27f30bed9db3c589b9d.tar.zst Shaarli-9186ab95943b7c2467a0f27f30bed9db3c589b9d.zip |
LinkDB::filterDay(): check input date format
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/UtilsTest.php')
-rw-r--r-- | tests/UtilsTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/UtilsTest.php b/tests/UtilsTest.php index bbba99f2..90392dfb 100644 --- a/tests/UtilsTest.php +++ b/tests/UtilsTest.php | |||
@@ -74,5 +74,24 @@ class UtilsTest extends PHPUnit_Framework_TestCase | |||
74 | $this->assertTrue(endsWith('å!ùµ', 'ùµ', false)); | 74 | $this->assertTrue(endsWith('å!ùµ', 'ùµ', false)); |
75 | $this->assertTrue(endsWith('µ$åù', 'åù', true)); | 75 | $this->assertTrue(endsWith('µ$åù', 'åù', true)); |
76 | } | 76 | } |
77 | |||
78 | /** | ||
79 | * Check valid date strings, according to a DateTime format | ||
80 | */ | ||
81 | public function testCheckValidDateFormat() | ||
82 | { | ||
83 | $this->assertTrue(checkDateFormat('Ymd', '20150627')); | ||
84 | $this->assertTrue(checkDateFormat('Y-m-d', '2015-06-27')); | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * Check erroneous date strings, according to a DateTime format | ||
89 | */ | ||
90 | public function testCheckInvalidDateFormat() | ||
91 | { | ||
92 | $this->assertFalse(checkDateFormat('Ymd', '2015')); | ||
93 | $this->assertFalse(checkDateFormat('Y-m-d', '2015-06')); | ||
94 | $this->assertFalse(checkDateFormat('Ymd', 'DeLorean')); | ||
95 | } | ||
77 | } | 96 | } |
78 | ?> | 97 | ?> |