aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrunoais <brunoaiss@gmail.com>2015-03-15 21:01:00 +0000
committerbrunoais <brunoaiss@gmail.com>2015-03-17 20:33:10 +0000
commitfe132f19e8d5c821fff936d208fbb981aa6ac92d (patch)
tree3c073fb2bb2369b593c62a825f1ff3842b50202e /tests/dbal
parent[feature/sql-bool-builder] Adding the IS operator to predicted operators (diff)
downloadphpbb-fe132f19e8d5c821fff936d208fbb981aa6ac92d.tar.gz
phpbb-fe132f19e8d5c821fff936d208fbb981aa6ac92d.tar.bz2
phpbb-fe132f19e8d5c821fff936d208fbb981aa6ac92d.zip
[feature/sql-bool-builder] Improved tests output to show the SQL error.
PHPBB3-13652
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/boolean_processor_test.php47
1 files changed, 40 insertions, 7 deletions
diff --git a/tests/dbal/boolean_processor_test.php b/tests/dbal/boolean_processor_test.php
index 5e044797f8..8662485ac8 100644
--- a/tests/dbal/boolean_processor_test.php
+++ b/tests/dbal/boolean_processor_test.php
@@ -45,7 +45,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
array('user_id' => '2'),
array('user_id' => '3'),
array('user_id' => '6'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_single_like()
@@ -70,7 +74,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
$this->assertEquals(array(
array('user_id' => '4'),
array('user_id' => '5'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_single_not_in()
@@ -96,7 +104,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
array('user_id' => '1'),
array('user_id' => '2'),
array('user_id' => '6'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_single_in()
@@ -122,7 +134,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
array('user_id' => '3'),
array('user_id' => '4'),
array('user_id' => '5'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_and_of_or_of_and()
@@ -168,7 +184,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
$this->assertEquals(array(
array('user_id' => '2'),
array('user_id' => '4'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_triple_and_with_in()
@@ -200,6 +220,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
array('user_id' => '2'),
array('user_id' => '3'),
), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
+
}
public function test_double_and_with_not_of_or()
@@ -230,7 +255,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
$db->sql_return_on_error(false);
- $this->assertEquals(array(), $db->sql_fetchrowset($result));
+ $this->assertEquals(array(), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
public function test_triple_and_with_is_null()
@@ -268,6 +297,10 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
$this->assertEquals(array(
array('username' => 'helper'),
array('username' => 'mass email'),
- ), $db->sql_fetchrowset($result));
+ ), $db->sql_fetchrowset($result),
+ ($result === false) ?
+ "SQL ERROR:<br>" . var_export($sql, true) . "<br>" . $db->sql_error() :
+ var_export($sql, true) . ' ' . var_export($result, true)
+ );
}
}