summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2017-01-19 14:17:00 +0100
committerAndrey Andreev <narf@devilix.net>2017-01-19 14:17:00 +0100
commitf565212c5aa07a8016394a3bc66874be83c73d4d (patch)
treed96a826347978c3054b565504f901445310b17b3 /tests
parent2649e6e3f3d2a44fd09a25e6f8f70848a75dbed5 (diff)
Fix byte-safety issues & actually test for them
Diffstat (limited to 'tests')
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php16
-rw-r--r--tests/phpunit.xml10
2 files changed, 18 insertions, 8 deletions
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 @@
</testsuite>
</testsuites>
<filter>
- <blacklist>
- <directory suffix=".php">PEAR_INSTALL_DIR</directory>
- <directory suffix=".php">PHP_LIBDIR</directory>
- <directory suffix=".php">../vendor</directory>
- </blacklist>
+ <whitelist>
+ <directory suffix=".php">../system/</directory>
+ </whitelist>
</filter>
-</phpunit> \ No newline at end of file
+</phpunit>