aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2013-03-27 23:33:13 +0100
committerAndreas Fischer <bantu@phpbb.com>2013-03-28 00:28:50 +0100
commitb88eb3c8e099e1a0634ab84e9e1c215c00410264 (patch)
treed8b66a0945d56353e9e17ff4066b4920d61e67d6 /tests/dbal
parent873f098b6ccc108dc293054f2cf7cb7231684caa (diff)
downloadforums-b88eb3c8e099e1a0634ab84e9e1c215c00410264.tar
forums-b88eb3c8e099e1a0634ab84e9e1c215c00410264.tar.gz
forums-b88eb3c8e099e1a0634ab84e9e1c215c00410264.tar.bz2
forums-b88eb3c8e099e1a0634ab84e9e1c215c00410264.tar.xz
forums-b88eb3c8e099e1a0634ab84e9e1c215c00410264.zip
[ticket/11469] Do not repeat row generation.
PHPBB3-11469
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/sql_insert_buffer_test.php63
1 files changed, 18 insertions, 45 deletions
diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php
index 59bfb73d0f..650a42c36d 100644
--- a/tests/dbal/sql_insert_buffer_test.php
+++ b/tests/dbal/sql_insert_buffer_test.php
@@ -24,11 +24,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
$this->assert_config_count($db, 2);
// This call can be buffered
- $this->assertTrue($buffer->insert(array(
- 'config_name' => 'name1',
- 'config_value' => 'value1',
- 'is_dynamic' => '0',
- )));
+ $this->assertTrue($buffer->insert($this->get_row(1)));
$this->assert_config_count($db, 3);
@@ -52,11 +48,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
$this->assert_config_count($db, 2);
// This call can be buffered
- $this->assertFalse($buffer->insert(array(
- 'config_name' => 'name1',
- 'config_value' => 'value1',
- 'is_dynamic' => '0',
- )));
+ $this->assertFalse($buffer->insert($this->get_row(1)));
$this->assert_config_count($db, 2);
@@ -75,18 +67,10 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
$this->assert_config_count($db, 2);
- $this->assertTrue($buffer->insert(array(
- 'config_name' => 'name1',
- 'config_value' => 'value1',
- 'is_dynamic' => '0',
- )));
+ $this->assertTrue($buffer->insert($this->get_row(1)));
// This call flushes the values
- $this->assertTrue($buffer->insert(array(
- 'config_name' => 'name2',
- 'config_value' => 'value2',
- 'is_dynamic' => '0',
- )));
+ $this->assertTrue($buffer->insert($this->get_row(2)));
$this->assert_config_count($db, 4);
}
@@ -104,18 +88,10 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
$this->assert_config_count($db, 2);
- $this->assertFalse($buffer->insert(array(
- 'config_name' => 'name1',
- 'config_value' => 'value1',
- 'is_dynamic' => '0',
- )));
+ $this->assertFalse($buffer->insert($this->get_row(1)));
// This call flushes the values
- $this->assertTrue($buffer->insert(array(
- 'config_name' => 'name2',
- 'config_value' => 'value2',
- 'is_dynamic' => '0',
- )));
+ $this->assertTrue($buffer->insert($this->get_row(2)));
$this->assert_config_count($db, 4);
}
@@ -166,24 +142,21 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
+ protected function get_row($rownum)
+ {
+ return array(
+ 'config_name' => "name$rownum",
+ 'config_value' => "value$rownum",
+ 'is_dynamic' => '0',
+ );
+ }
+
protected function get_three_rows()
{
return array(
- array(
- 'config_name' => 'name1',
- 'config_value' => 'value1',
- 'is_dynamic' => '0',
- ),
- array(
- 'config_name' => 'name2',
- 'config_value' => 'value2',
- 'is_dynamic' => '0',
- ),
- array(
- 'config_name' => 'name3',
- 'config_value' => 'value3',
- 'is_dynamic' => '0',
- ),
+ $this->get_row(1),
+ $this->get_row(2),
+ $this->get_row(3),
);
}
}