mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-18 15:41:26 +02:00
[feature/sql-bool-builder] Improved tests output to show the SQL error.
PHPBB3-13652
This commit is contained in:
@@ -45,7 +45,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
|
|||||||
array('user_id' => '2'),
|
array('user_id' => '2'),
|
||||||
array('user_id' => '3'),
|
array('user_id' => '3'),
|
||||||
array('user_id' => '6'),
|
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()
|
public function test_single_like()
|
||||||
@@ -70,7 +74,11 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case
|
|||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
array('user_id' => '4'),
|
array('user_id' => '4'),
|
||||||
array('user_id' => '5'),
|
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()
|
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' => '1'),
|
||||||
array('user_id' => '2'),
|
array('user_id' => '2'),
|
||||||
array('user_id' => '6'),
|
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()
|
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' => '3'),
|
||||||
array('user_id' => '4'),
|
array('user_id' => '4'),
|
||||||
array('user_id' => '5'),
|
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()
|
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(
|
$this->assertEquals(array(
|
||||||
array('user_id' => '2'),
|
array('user_id' => '2'),
|
||||||
array('user_id' => '4'),
|
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()
|
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' => '2'),
|
||||||
array('user_id' => '3'),
|
array('user_id' => '3'),
|
||||||
), $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_double_and_with_not_of_or()
|
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);
|
$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()
|
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(
|
$this->assertEquals(array(
|
||||||
array('username' => 'helper'),
|
array('username' => 'helper'),
|
||||||
array('username' => 'mass email'),
|
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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user