diff options
author | Andrey Andreev <narf@devilix.net> | 2017-03-24 10:04:53 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2017-03-24 10:04:53 +0100 |
commit | c7c0bdf4f7af7c4e71b073ee87ddb792087bdfac (patch) | |
tree | 5cfb825e1e0d67f30d4c8a91428cd52eb580695a /tests/codeigniter | |
parent | 1d9aaee34ea77fdb68d79d7add37f26dd2649c00 (diff) | |
parent | 0eb38af2eaf1127b9b82261b7ec3bf4d4b847318 (diff) |
Merge branch '3.1-stable' into develop
Conflicts resolved:
system/core/CodeIgniter.php
system/core/Common.php
system/core/Input.php
system/helpers/cookie_helper.php
tests/codeigniter/helpers/html_helper_test.php
user_guide_src/source/changelog.rst
user_guide_src/source/conf.py
user_guide_src/source/installation/downloads.rst
user_guide_src/source/installation/upgrading.rst
user_guide_src/source/libraries/input.rst
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/helpers/html_helper_test.php | 14 | ||||
-rw-r--r-- | tests/codeigniter/libraries/Encryption_test.php | 16 |
2 files changed, 28 insertions, 2 deletions
diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php index 5565e011b..3ca23e015 100644 --- a/tests/codeigniter/helpers/html_helper_test.php +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -33,6 +33,20 @@ class Html_helper_test extends CI_TestCase { // ------------------------------------------------------------------------ + public function test_img() + { + $this->ci_set_config('base_url', 'http://localhost/'); + $this->assertEquals('<img src="http://localhost/test" alt="" />', img("test")); + $this->assertEquals('<img src="data:foo/bar,baz" alt="" />', img("data:foo/bar,baz")); + $this->assertEquals('<img src="http://localhost/data://foo" alt="" />', img("data://foo")); + $this->assertEquals('<img src="//foo.bar/baz" alt="" />', img("//foo.bar/baz")); + $this->assertEquals('<img src="http://foo.bar/baz" alt="" />', img("http://foo.bar/baz")); + $this->assertEquals('<img src="https://foo.bar/baz" alt="" />', img("https://foo.bar/baz")); + $this->assertEquals('<img src="ftp://foo.bar/baz" alt="" />', img("ftp://foo.bar/baz")); + } + + // ------------------------------------------------------------------------ + public function test_Ul() { $expect = <<<EOH diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index 96e52ada8..99c5d4b9d 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -94,10 +94,22 @@ class Encryption_test extends CI_TestCase { } // Test default length, it must match the digest size - $this->assertEquals(64, strlen($this->encryption->hkdf('foobar', 'sha512'))); + $hkdf_result = $this->encryption->hkdf('foobar', 'sha512'); + $this->assertEquals( + 64, + defined('MB_OVERLOAD_STRING') + ? mb_strlen($hkdf_result, '8bit') + : strlen($hkdf_result) + ); // Test maximum length (RFC5869 says that it must be up to 255 times the digest size) - $this->assertEquals(12240, strlen($this->encryption->hkdf('foobar', 'sha384', NULL, 48 * 255))); + $hkdf_result = $this->encryption->hkdf('foobar', 'sha384', NULL, 48 * 255); + $this->assertEquals( + 12240, + defined('MB_OVERLOAD_STRING') + ? mb_strlen($hkdf_result, '8bit') + : strlen($hkdf_result) + ); $this->assertFalse($this->encryption->hkdf('foobar', 'sha224', NULL, 28 * 255 + 1)); // CI-specific test for an invalid digest |