aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/config/db_text_test.php12
-rw-r--r--tests/dbal/sql_affected_rows_test.php64
-rw-r--r--tests/functional/visibility_reapprove_test.php3
3 files changed, 75 insertions, 4 deletions
diff --git a/tests/config/db_text_test.php b/tests/config/db_text_test.php
index 354c0efacf..59730edf09 100644
--- a/tests/config/db_text_test.php
+++ b/tests/config/db_text_test.php
@@ -9,8 +9,8 @@
class phpbb_config_db_text_test extends phpbb_database_test_case
{
- private $db;
- private $config_text;
+ /** @var \phpbb\config\db_text */
+ protected $config_text;
public function getDataSet()
{
@@ -48,6 +48,12 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
$this->assertSame('24', $this->config_text->get('foo'));
}
+ public function test_set_same_value_get()
+ {
+ $this->config_text->set('foo', '23');
+ $this->assertSame('23', $this->config_text->get('foo'));
+ }
+
public function test_set_get_long_string()
{
$expected = str_repeat('ABC', 10000);
@@ -89,6 +95,8 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
'baby' => 'phpBB',
// Entry update
'bar' => '64',
+ // Entry update - same value
+ 'foo' => '23',
);
$this->config_text->set_array($set_array_param);
diff --git a/tests/dbal/sql_affected_rows_test.php b/tests/dbal/sql_affected_rows_test.php
new file mode 100644
index 0000000000..860b8bf237
--- /dev/null
+++ b/tests/dbal/sql_affected_rows_test.php
@@ -0,0 +1,64 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_dbal_sql_affected_rows_test extends phpbb_database_test_case
+{
+ /** @var \phpbb\db\driver\driver_interface */
+ protected $db;
+
+ public function setUp()
+ {
+ parent::setUp();
+ $this->db = $this->new_dbal();
+ }
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
+ }
+
+ public function test_update()
+ {
+ $sql = 'UPDATE ' . CONFIG_TABLE . "
+ SET config_value = 'bertie'";
+ $this->db->sql_query($sql);
+
+ $this->assertEquals(2, $this->db->sql_affectedrows());
+ }
+
+ public function test_update_all_matched_unequal_updated()
+ {
+ $sql = 'UPDATE ' . CONFIG_TABLE . "
+ SET config_value = 'foo'";
+ $this->db->sql_query($sql);
+
+ $this->assertEquals(2, $this->db->sql_affectedrows());
+ }
+
+ public function test_update_same_value_matched_unequal_updated()
+ {
+ $sql = 'UPDATE ' . CONFIG_TABLE . "
+ SET config_value = 'foo'
+ WHERE config_value = 'foo'";
+ $this->db->sql_query($sql);
+
+ $this->assertEquals(1, $this->db->sql_affectedrows());
+ }
+
+ public function test_insert()
+ {
+ $sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . $this->db->sql_build_array('INSERT', array(
+ 'config_name' => 'bertie',
+ 'config_value' => 'rules',
+ ));
+ $this->db->sql_query($sql);
+
+ $this->assertEquals(1, $this->db->sql_affectedrows());
+ }
+}
diff --git a/tests/functional/visibility_reapprove_test.php b/tests/functional/visibility_reapprove_test.php
index 70134ef724..57a1212c57 100644
--- a/tests/functional/visibility_reapprove_test.php
+++ b/tests/functional/visibility_reapprove_test.php
@@ -208,8 +208,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
$crawler = self::submit($form);
$form = $crawler->selectButton($this->lang('YES'))->form();
$crawler = self::submit($form);
- //@todo $this->assertContainsLang('TOPIC_APPROVED_SUCCESS', $crawler->text());
- $this->assertContainsLang('POST_APPROVED_SUCCESS', $crawler->text());
+ $this->assertContainsLang('TOPIC_APPROVED_SUCCESS', $crawler->text());
$this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array(
'forum_posts_approved' => 3,