aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal/dbal.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2010-04-13 20:23:46 +0200
committerAndreas Fischer <bantu@phpbb.com>2010-06-17 16:06:10 +0200
commite3420de295fdc1e4301882b9b764b9732669a7d0 (patch)
tree0a207f7710df8b5fb47d7213f9346914607461d9 /tests/dbal/dbal.php
parentd9c2e6cbcf7d7d3938656e4490aaf117a97e3448 (diff)
downloadforums-e3420de295fdc1e4301882b9b764b9732669a7d0.tar
forums-e3420de295fdc1e4301882b9b764b9732669a7d0.tar.gz
forums-e3420de295fdc1e4301882b9b764b9732669a7d0.tar.bz2
forums-e3420de295fdc1e4301882b9b764b9732669a7d0.tar.xz
forums-e3420de295fdc1e4301882b9b764b9732669a7d0.zip
[feature/dbal-tests] Update data
PHPBB3-9625
Diffstat (limited to 'tests/dbal/dbal.php')
-rw-r--r--tests/dbal/dbal.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php
index 9db11fb3d5..2eec4363f8 100644
--- a/tests/dbal/dbal.php
+++ b/tests/dbal/dbal.php
@@ -406,5 +406,47 @@ class phpbb_dbal_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
+
+ public static function update_data()
+ {
+ return array(
+ array(array('config_value' => '20', 'is_dynamic' => 0), " WHERE config_name = 'batch one'", array(array(
+ 'config_name' => 'batch one',
+ 'config_value' => '20',
+ 'is_dynamic' => 0,
+ ), array(
+ 'config_name' => 'batch two',
+ 'config_value' => 'b2',
+ 'is_dynamic' => 1,
+ ))),
+ array(array('config_value' => '0', 'is_dynamic' => 1), '', array(array(
+ 'config_name' => 'batch one',
+ 'config_value' => '0',
+ 'is_dynamic' => 1,
+ ), array(
+ 'config_name' => 'batch two',
+ 'config_value' => '0',
+ 'is_dynamic' => 1,
+ ))),
+ );
+ }
+
+ /**
+ * @dataProvider update_data
+ */
+ public function test_update($sql_ary, $where, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $result = $db->sql_query('UPDATE phpbb_config
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where);
+
+ $result = $db->sql_query('SELECT *
+ FROM phpbb_config');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
}