diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2010-04-13 20:12:09 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-06-17 16:06:10 +0200 |
commit | 539ae0ffafb7981e5d1918183044487f8a6c3a9e (patch) | |
tree | e76c89b24924bad73a9684329aa79db96aab9997 /tests/dbal/dbal.php | |
parent | b03a7a2c833037e6924b622b56b79778052ecd73 (diff) | |
download | forums-539ae0ffafb7981e5d1918183044487f8a6c3a9e.tar forums-539ae0ffafb7981e5d1918183044487f8a6c3a9e.tar.gz forums-539ae0ffafb7981e5d1918183044487f8a6c3a9e.tar.bz2 forums-539ae0ffafb7981e5d1918183044487f8a6c3a9e.tar.xz forums-539ae0ffafb7981e5d1918183044487f8a6c3a9e.zip |
[feature/dbal-tests] Insert data
PHPBB3-9625
Diffstat (limited to 'tests/dbal/dbal.php')
-rw-r--r-- | tests/dbal/dbal.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 02fe8c29a9..98f31d9398 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -316,5 +316,39 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } + + public static function build_array_insert_data() + { + return array( + array(array( + 'config_name' => 'test_version', + 'config_value' => '0.0.0', + 'is_dynamic' => 1, + )), + array(array( + 'config_name' => 'second config', + 'config_value' => '10', + 'is_dynamic' => 0, + )), + ); + } + + /** + * @dataProvider build_array_insert_data + */ + public function test_build_array_insert($sql_ary) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary)); + + $result = $db->sql_query_limit("SELECT * + FROM phpbb_config + WHERE config_name = '" . $sql_ary['config_name'] . "'", 1); + + $this->assertEquals($sql_ary, $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + } } |