From 71d8f72ffc48a7f46747b3b6b1a554533cc1cbc5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 17 Jan 2017 12:01:00 +0200 Subject: [ci skip] Merge pull request #4986 from ka7/feature/spelling Spelling fixes in comment blocks and docs --- tests/codeigniter/helpers/date_helper_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/codeigniter/helpers/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php index 8a3502280..b419418bf 100644 --- a/tests/codeigniter/helpers/date_helper_test.php +++ b/tests/codeigniter/helpers/date_helper_test.php @@ -296,7 +296,7 @@ class Date_helper_test extends CI_TestCase { } $this->assertArrayHasKey('UP3', timezones()); - $this->assertEquals(0, timezones('non_existant')); + $this->assertEquals(0, timezones('non_existent')); } // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From f565212c5aa07a8016394a3bc66874be83c73d4d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 19 Jan 2017 15:17:00 +0200 Subject: Fix byte-safety issues & actually test for them --- tests/codeigniter/libraries/Encryption_test.php | 16 ++++++++++++++-- tests/phpunit.xml | 10 ++++------ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'tests') 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 diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 96c3af9bb..875198c4e 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -17,10 +17,8 @@ - - PEAR_INSTALL_DIR - PHP_LIBDIR - ../vendor - + + ../system/ + - \ No newline at end of file + -- cgit v1.2.3-24-g4f1b From 356bc66ebcd6a4d48c28fd119233e9d0bb12375f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 6 Mar 2017 14:39:28 +0200 Subject: Fix #5044; add unit tests for img() HTML helper --- tests/codeigniter/helpers/html_helper_test.php | 16 +++++++++++++++- tests/mocks/ci_testconfig.php | 8 ++++---- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php index d66ad895c..3cf1016ec 100644 --- a/tests/codeigniter/helpers/html_helper_test.php +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -40,6 +40,20 @@ class Html_helper_test extends CI_TestCase { // ------------------------------------------------------------------------ + public function test_img() + { + $this->ci_set_config('base_url', 'http://localhost/'); + $this->assertEquals('', img("test")); + $this->assertEquals('', img("data:foo/bar,baz")); + $this->assertEquals('', img("data://foo")); + $this->assertEquals('', img("//foo.bar/baz")); + $this->assertEquals('', img("http://foo.bar/baz")); + $this->assertEquals('', img("https://foo.bar/baz")); + $this->assertEquals('', img("ftp://foo.bar/baz")); + } + + // ------------------------------------------------------------------------ + public function test_Ul() { $expect = <<config[$key]) ? $this->config[$key] : FALSE; } - public function load($file, $arg2 = FALSE, $arg3 = FALSE) + public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { $this->loaded[] = $file; return TRUE; } -} \ No newline at end of file +} -- cgit v1.2.3-24-g4f1b