aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utf')
-rw-r--r--tests/utf/data/.gitkeep0
-rw-r--r--tests/utf/normalizer_test.php23
-rw-r--r--tests/utf/utf8_clean_string_test.php4
-rw-r--r--tests/utf/utf8_wordwrap_test.php2
4 files changed, 17 insertions, 12 deletions
diff --git a/tests/utf/data/.gitkeep b/tests/utf/data/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
--- a/tests/utf/data/.gitkeep
+++ /dev/null
diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php
index 38b4ec1b6b..92230cfcc9 100644
--- a/tests/utf/normalizer_test.php
+++ b/tests/utf/normalizer_test.php
@@ -3,7 +3,7 @@
*
* @package testing
* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -14,10 +14,13 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_normalizer.php';
*/
class phpbb_utf_normalizer_test extends phpbb_test_case
{
+ static private $data_dir;
+
static public function setUpBeforeClass()
{
- self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', dirname(__FILE__).'/data');
- self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', dirname(__FILE__).'/data');
+ self::$data_dir = dirname(__file__) . '/../tmp';
+ self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', self::$data_dir);
+ self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', self::$data_dir);
}
public function test_normalizer()
@@ -62,7 +65,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
$tested_chars = array();
- $fp = fopen(dirname(__FILE__).'/data/NormalizationTest.txt', 'rb');
+ $fp = fopen(self::$data_dir . '/NormalizationTest.txt', 'rb');
while (!feof($fp))
{
$line = fgets($fp);
@@ -99,7 +102,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
foreach ($tests as $test)
{
$utf_result = $utf_expected;
- call_user_func(array('utf_normalizer', $form), &$utf_result);
+ call_user_func_array(array('utf_normalizer', $form), array(&$utf_result));
$hex_result = $this->utf_to_hexseq($utf_result);
$this->assertEquals($utf_expected, $utf_result, "$expected == $form($test) ($hex_expected != $hex_result)");
@@ -117,7 +120,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
*/
public function test_invariants(array $tested_chars)
{
- $fp = fopen(dirname(__FILE__).'/data/UnicodeData.txt', 'rb');
+ $fp = fopen(self::$data_dir . '/UnicodeData.txt', 'rb');
while (!feof($fp))
{
@@ -151,7 +154,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
foreach (array('nfc', 'nfkc', 'nfd', 'nfkd') as $form)
{
$utf_result = $utf_expected;
- call_user_func(array('utf_normalizer', $form), &$utf_result);
+ call_user_func_array(array('utf_normalizer', $form), array(&$utf_result));
$hex_result = $this->utf_to_hexseq($utf_result);
$this->assertEquals($utf_expected, $utf_result, "$hex_expected == $form($hex_tested) ($hex_expected != $hex_result)");
@@ -298,12 +301,14 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
if (!$fpr = fopen($url, 'rb'))
{
- throw new RuntimeException("Failed to download $url");
+ echo "Failed to download $url\n";
+ return;
}
if (!$fpw = fopen($target, 'wb'))
{
- throw new RuntimeException("Failed to open $target for writing");
+ echo "Failed to open $target for writing\n";
+ return;
}
$chunk = 32768;
diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php
index e5a771eafa..ae11e00fbd 100644
--- a/tests/utf/utf8_clean_string_test.php
+++ b/tests/utf/utf8_clean_string_test.php
@@ -3,7 +3,7 @@
*
* @package testing
* @copyright (c) 2008 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
@@ -11,7 +11,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
class phpbb_utf_utf8_clean_string_test extends phpbb_test_case
{
- public static function cleanable_strings()
+ public function cleanable_strings()
{
return array(
array('MiXed CaSe', 'mixed case', 'Checking case folding'),
diff --git a/tests/utf/utf8_wordwrap_test.php b/tests/utf/utf8_wordwrap_test.php
index 03fa9dc38c..39fdf73308 100644
--- a/tests/utf/utf8_wordwrap_test.php
+++ b/tests/utf/utf8_wordwrap_test.php
@@ -3,7 +3,7 @@
*
* @package testing
* @copyright (c) 2008 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/