diff options
author | brunoais <brunoaiss@gmail.com> | 2015-03-15 20:30:04 +0000 |
---|---|---|
committer | brunoais <brunoaiss@gmail.com> | 2015-03-16 23:16:46 +0000 |
commit | 5f63d685f6b0235badd7723e477754833595d045 (patch) | |
tree | 1cfa8268a30b676931c9752ff6aa036c2d9045dc /tests/dbal/boolean_processor_test.php | |
parent | e6eab35a641b8795f8a277e28d3eab0937d64b6d (diff) | |
download | forums-5f63d685f6b0235badd7723e477754833595d045.tar forums-5f63d685f6b0235badd7723e477754833595d045.tar.gz forums-5f63d685f6b0235badd7723e477754833595d045.tar.bz2 forums-5f63d685f6b0235badd7723e477754833595d045.tar.xz forums-5f63d685f6b0235badd7723e477754833595d045.zip |
[feature/sql-bool-builder] test_and_of_or_of_and
PHPBB3-13652
Diffstat (limited to 'tests/dbal/boolean_processor_test.php')
-rw-r--r-- | tests/dbal/boolean_processor_test.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/dbal/boolean_processor_test.php b/tests/dbal/boolean_processor_test.php index 081a5ac64d..716e524e9b 100644 --- a/tests/dbal/boolean_processor_test.php +++ b/tests/dbal/boolean_processor_test.php @@ -21,6 +21,52 @@ class phpbb_boolean_processor_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/boolean_processor.xml'); } + public function test_and_of_or_of_and() + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $sql_ary = array( + 'SELECT' => 'u.user_id', + 'FROM' => array( + 'phpbb_users' => 'u', + 'phpbb_user_group' => 'ug', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array( + 'phpbb_banlist' => 'b', + ), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => array('AND', + array('OR', + array('AND', + array('ug.user_id', 'IN', array(1, 2, 3, 4)), + array('ug.group_id', '=', 2), + ), + array('AND', + array('ug.group_id', '=', 1), + array('b.ban_id', 'IS NOT', NULL), + ), + ), + array('u.user_id', '=', 'ug.user_id'), + ), + 'ORDER_BY' => 'u.user_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $db->sql_return_on_error(false); + + $this->assertEquals(array( + array('user_id' => '2'), + array('user_id' => '4'), + ), $db->sql_fetchrowset($result)); + } + public function test_triple_and_with_in() { $db = $this->new_dbal(); |