From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position

---
 tests/Framework/BaseReplacer.php |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/tests/Framework/BaseReplacer.php b/tests/Framework/BaseReplacer.php
index e00b9e5..2255e9a 100644
--- a/tests/Framework/BaseReplacer.php
+++ b/tests/Framework/BaseReplacer.php
@@ -17,4 +17,46 @@
 
         $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);
+    }
+
+    /**
+     * Data for absolute_url() test
+     */
+    function data_absolute_url()
+    {
+        return array(
+            array('', 'http://test', 'http://test/'),
+            array('http://test', 'http://anything', 'http://test'),
+            array('cid:test', 'http://anything', 'cid:test'),
+            array('/test', 'http://test', 'http://test/test'),
+            array('./test', 'http://test', 'http://test/test'),
+            array('../test1', 'http://test/test2', 'http://test1'),
+            array('../test1', 'http://test/test2/', 'http://test/test1'),
+        );
+    }
+
+    /**
+     * Test absolute_url()
+     * @dataProvider data_absolute_url
+     */
+    function test_absolute_url($path, $base, $expected)
+    {
+        $replacer = new rcube_base_replacer('test');
+        $result   = $replacer->absolute_url($path, $base);
+
+        $this->assertSame($expected, $result);
+    }
 }

--
Gitblit v1.9.1