aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/dbal/select_test.php18
-rw-r--r--tests/profile/custom_test.php2
-rw-r--r--tests/template/template_test.php12
-rw-r--r--tests/template/templates/lang.html2
-rw-r--r--tests/template/templates/loop_nested_deep_multilevel_ref.html3
-rw-r--r--tests/utf/normalizer_test.php4
6 files changed, 30 insertions, 11 deletions
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index e0d08d9306..8ddd27465d 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -319,7 +319,7 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
- function test_nested_transactions()
+ public function test_nested_transactions()
{
$db = $this->new_dbal();
@@ -341,4 +341,20 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$this->assertEquals('1', $row['user_id']);
}
+
+ /**
+ * fix for PHPBB3-10307
+ */
+ public function test_sql_fetchrow_returns_false_when_empty()
+ {
+ $db = $this->new_dbal();
+
+ $sql = 'SELECT * FROM (SELECT 1) AS TBL WHERE 1 = 0';
+ $result = $db->sql_query($sql);
+
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $this->assertSame(false, $row);
+ }
}
diff --git a/tests/profile/custom_test.php b/tests/profile/custom_test.php
index 0e0a851243..585182e583 100644
--- a/tests/profile/custom_test.php
+++ b/tests/profile/custom_test.php
@@ -48,7 +48,7 @@ class phpbb_profile_custom_test extends phpbb_database_test_case
);
$cp = new custom_profile;
- $result = $cp->validate_profile_field(FIELD_DROPDOWN, &$field_value, $field_data);
+ $result = $cp->validate_profile_field(FIELD_DROPDOWN, $field_value, $field_data);
$this->assertEquals($expected, $result, $description);
}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 28eba05217..86ff2e9ec6 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -211,21 +211,21 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array(),
array(),
- "{ VARIABLE }\n{ VARIABLE }",
+ "{ VARIABLE }\n{ 1_VARIABLE }\n{ VARIABLE }\n{ 1_VARIABLE }",
),
array(
'lang.html',
- array('L_VARIABLE' => "Value'"),
+ array('L_VARIABLE' => "Value'", 'L_1_VARIABLE' => "1 O'Clock"),
array(),
array(),
- "Value'\nValue\'",
+ "Value'\n1 O'Clock\nValue\'\n1 O\'Clock",
),
array(
'lang.html',
- array('LA_VARIABLE' => "Value'"),
+ array('LA_VARIABLE' => "Value'", 'LA_1_VARIABLE' => "1 O'Clock"),
array(),
array(),
- "{ VARIABLE }\nValue'",
+ "{ VARIABLE }\n{ 1_VARIABLE }\nValue'\n1 O'Clock",
),
array(
'loop_nested_multilevel_ref.html',
@@ -248,7 +248,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array('outer' => array(array()), 'outer.middle' => array(array()), 'outer.middle.inner' => array(array('VARIABLE' => 'z'), array('VARIABLE' => 'zz'))),
array(),
// I don't completely understand this output, hopefully it's correct
- "top-level content\nouter\n\ninner z\nfirst row\n\ninner zz",
+ "top-level content\nouter\nmiddle\ninner z\nfirst row of 2 in inner\n\ninner zz",
),
array(
'loop_size.html',
diff --git a/tests/template/templates/lang.html b/tests/template/templates/lang.html
index 2b5ea1cafe..3eecc298cb 100644
--- a/tests/template/templates/lang.html
+++ b/tests/template/templates/lang.html
@@ -1,3 +1,5 @@
{L_VARIABLE}
+{L_1_VARIABLE}
{LA_VARIABLE}
+{LA_1_VARIABLE}
diff --git a/tests/template/templates/loop_nested_deep_multilevel_ref.html b/tests/template/templates/loop_nested_deep_multilevel_ref.html
index 60fad7b4cd..bcc2a7c07b 100644
--- a/tests/template/templates/loop_nested_deep_multilevel_ref.html
+++ b/tests/template/templates/loop_nested_deep_multilevel_ref.html
@@ -2,10 +2,11 @@ top-level content
<!-- BEGIN outer -->
outer
<!-- BEGIN middle -->
+ {outer.middle.S_BLOCK_NAME}
<!-- BEGIN inner -->
inner {inner.VARIABLE}
<!-- IF outer.middle.inner.S_FIRST_ROW -->
- first row
+ first row of {outer.middle.inner.S_NUM_ROWS} in {middle.inner.S_BLOCK_NAME}
<!-- ENDIF -->
<!-- END inner -->
<!-- END middle -->
diff --git a/tests/utf/normalizer_test.php b/tests/utf/normalizer_test.php
index a0ba470416..1dc69e283e 100644
--- a/tests/utf/normalizer_test.php
+++ b/tests/utf/normalizer_test.php
@@ -102,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)");
@@ -154,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)");