diff options
Diffstat (limited to 'tests/Framework')
-rw-r--r-- | tests/Framework/BaseReplacer.php | 14 | ||||
-rw-r--r-- | tests/Framework/StringReplacer.php | 1 | ||||
-rw-r--r-- | tests/Framework/Utils.php | 10 |
3 files changed, 24 insertions, 1 deletions
diff --git a/tests/Framework/BaseReplacer.php b/tests/Framework/BaseReplacer.php index e00b9e5eb..44a9604ac 100644 --- a/tests/Framework/BaseReplacer.php +++ b/tests/Framework/BaseReplacer.php @@ -17,4 +17,18 @@ class Framework_BaseReplacer extends PHPUnit_Framework_TestCase $this->assertInstanceOf('rcube_base_replacer', $object, "Class constructor"); } + + /** + * Test replace() + */ + function test_replace() + { + $base = 'http://thisshouldntbetheurl.bob.com/'; + $html = '<A href=http://shouldbethislink.com>Test URL</A>'; + + $replacer = new rcube_base_replacer($base); + $response = $replacer->replace($html); + + $this->assertSame('<A href="http://shouldbethislink.com">Test URL</A>', $response); + } } diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php index 8f6eaf4b9..e23fb9b17 100644 --- a/tests/Framework/StringReplacer.php +++ b/tests/Framework/StringReplacer.php @@ -41,6 +41,7 @@ class Framework_StringReplacer extends PHPUnit_Framework_TestCase array('http://', 'http://'), array('1@1.com www.domain.tld', '<a href="mailto:1@1.com">1@1.com</a> <a href="http://www.domain.tld">www.domain.tld</a>'), array(' www.domain.tld ', ' <a href="http://www.domain.tld">www.domain.tld</a> '), + array(' www.domain.tld/#!download|856p1|2 ', ' <a href="http://www.domain.tld/#!download|856p1|2">www.domain.tld/#!download|856p1|2</a> '), ); } diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php index abfb7cb65..3f7f48c3a 100644 --- a/tests/Framework/Utils.php +++ b/tests/Framework/Utils.php @@ -271,11 +271,19 @@ class Framework_Utils extends PHPUnit_Framework_TestCase $test = array( '1' => 1, '' => 0, + '2013-04-22' => 1366581600, + '2013/04/22' => 1366581600, + '2013.04.22' => 1366581600, + '22-04-2013' => 1366581600, + '22/04/2013' => 1366581600, + '22.04.2013' => 1366581600, + '22.4.2013' => 1366581600, + '20130422' => 1366581600, ); foreach ($test as $datetime => $ts) { $result = rcube_utils::strtotime($datetime); - $this->assertSame($ts, $result); + $this->assertSame($ts, $result, "Error parsing date: $datetime"); } } |