diff options
Diffstat (limited to 'tests/dbal')
34 files changed, 438 insertions, 81 deletions
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index 2196292e83..1ed8ea29e3 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/case_test.php b/tests/dbal/case_test.php index 57a1729a39..5f1c7d61fa 100644 --- a/tests/dbal/case_test.php +++ b/tests/dbal/case_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/concatenate_test.php b/tests/dbal/concatenate_test.php index 0891fa58a0..00e7e107aa 100644 --- a/tests/dbal/concatenate_test.php +++ b/tests/dbal/concatenate_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/connect_test.php b/tests/dbal/connect_test.php index 1e352d6b03..1ae34bd2b6 100644 --- a/tests/dbal/connect_test.php +++ b/tests/dbal/connect_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/cross_join_test.php b/tests/dbal/cross_join_test.php index 6c6b8a8449..7ba937ccc6 100644 --- a/tests/dbal/cross_join_test.php +++ b/tests/dbal/cross_join_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index df8f22083b..320eac3bf3 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/fixtures/styles.xml b/tests/dbal/fixtures/styles.xml index dcbe39d3b0..d51dcd0320 100644 --- a/tests/dbal/fixtures/styles.xml +++ b/tests/dbal/fixtures/styles.xml @@ -12,7 +12,7 @@ <row> <value>1</value> <value>prosilver</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>1</value> <value>prosilver</value> <value>kNg=</value> @@ -22,7 +22,7 @@ <row> <value>2</value> <value>prosilver2</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>0</value> <value>prosilver2</value> <value>kNg=</value> @@ -32,7 +32,7 @@ <row> <value>3</value> <value>Prosilver1</value> - <value>&copy; phpBB Group</value> + <value>&copy; phpBB Limited</value> <value>0</value> <value>prosilver1</value> <value>kNg=</value> diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php index b68a3673c1..d564754892 100644 --- a/tests/dbal/migration/dummy.php +++ b/tests/dbal/migration/dummy.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/dummy_order.php b/tests/dbal/migration/dummy_order.php new file mode 100644 index 0000000000..5ab8f5d129 --- /dev/null +++ b/tests/dbal/migration/dummy_order.php @@ -0,0 +1,30 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_tables' => array( + $this->table_prefix . 'column_order_test1' => array( + 'COLUMNS' => array( + 'foobar1' => array('BOOL', 0), + 'foobar3' => array('BOOL', 0), + ), + 'PRIMARY_KEY' => array('foobar1'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_0.php b/tests/dbal/migration/dummy_order_0.php new file mode 100644 index 0000000000..4caea76704 --- /dev/null +++ b/tests/dbal/migration/dummy_order_0.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_0 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar2' => array('BOOL', 0, 'after' => 'foobar1'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_1.php b/tests/dbal/migration/dummy_order_1.php new file mode 100644 index 0000000000..ea512765fa --- /dev/null +++ b/tests/dbal/migration/dummy_order_1.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_1 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar4' => array('BOOL', 0, 'after' => 'foobar3'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_2.php b/tests/dbal/migration/dummy_order_2.php new file mode 100644 index 0000000000..a7669b1ac8 --- /dev/null +++ b/tests/dbal/migration/dummy_order_2.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_2 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar5' => array('BOOL', 0, 'after' => 'non-existing'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_3.php b/tests/dbal/migration/dummy_order_3.php new file mode 100644 index 0000000000..501db09b7e --- /dev/null +++ b/tests/dbal/migration/dummy_order_3.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_3 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar6' => array('BOOL', 0, 'after' => ''), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_4.php b/tests/dbal/migration/dummy_order_4.php new file mode 100644 index 0000000000..77bb5a24b3 --- /dev/null +++ b/tests/dbal/migration/dummy_order_4.php @@ -0,0 +1,26 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_4 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar7' => array('BOOL', 0), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/dummy_order_5.php b/tests/dbal/migration/dummy_order_5.php new file mode 100644 index 0000000000..8f92392a8b --- /dev/null +++ b/tests/dbal/migration/dummy_order_5.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_dbal_migration_dummy_order_5 extends \phpbb\db\migration\migration +{ + function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'column_order_test1' => array( + 'foobar8' => array('BOOL', 0, 'after' => 'foobar3'), + 'foobar9' => array('BOOL', 0, 'after' => 'foobar3'), + ), + ), + ); + } +} diff --git a/tests/dbal/migration/fail.php b/tests/dbal/migration/fail.php index b0702a469a..a7a8a41694 100644 --- a/tests/dbal/migration/fail.php +++ b/tests/dbal/migration/fail.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/if.php b/tests/dbal/migration/if.php index 883d93c6e4..98a66526ed 100644 --- a/tests/dbal/migration/if.php +++ b/tests/dbal/migration/if.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/installed.php b/tests/dbal/migration/installed.php index cc4e81aff6..83edaae23a 100644 --- a/tests/dbal/migration/installed.php +++ b/tests/dbal/migration/installed.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php index af5e9243cf..c0333b084d 100644 --- a/tests/dbal/migration/recall.php +++ b/tests/dbal/migration/recall.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php index 1c98710ffb..7da65a83f1 100644 --- a/tests/dbal/migration/revert.php +++ b/tests/dbal/migration/revert.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/revert_with_dependency.php b/tests/dbal/migration/revert_with_dependency.php index ece16eb67c..43e9a4aa42 100644 --- a/tests/dbal/migration/revert_with_dependency.php +++ b/tests/dbal/migration/revert_with_dependency.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/schema.php b/tests/dbal/migration/schema.php index efe6891aaa..38663bcc16 100644 --- a/tests/dbal/migration/schema.php +++ b/tests/dbal/migration/schema.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php index 125629d27c..11c87a6b85 100644 --- a/tests/dbal/migration/unfulfillable.php +++ b/tests/dbal/migration/unfulfillable.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index cc3e92071f..4a1d15aea4 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -56,12 +60,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); + $user = new \phpbb\user(); $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, new phpbb\filesystem(), + $user, 'phpbb_ext', dirname(__FILE__) . '/../../phpBB/', 'php', diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php index 12644e4a23..13e0c13e3c 100644 --- a/tests/dbal/migrator_tool_config_test.php +++ b/tests/dbal/migrator_tool_config_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index c3358ef944..aeb69e27ac 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php index 4016cbcf20..4453fbf123 100644 --- a/tests/dbal/migrator_tool_permission_test.php +++ b/tests/dbal/migrator_tool_permission_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/order_lower_test.php b/tests/dbal/order_lower_test.php index d826765681..b7a69c7c5d 100644 --- a/tests/dbal/order_lower_test.php +++ b/tests/dbal/order_lower_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -36,7 +40,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 1, 'style_name' => 'prosilver', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 1, 'style_path' => 'prosilver', 'bbcode_bitfield' => 'kNg=', @@ -46,7 +50,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 3, 'style_name' => 'Prosilver1', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 0, 'style_path' => 'prosilver1', 'bbcode_bitfield' => 'kNg=', @@ -56,7 +60,7 @@ class phpbb_dbal_order_lower_test extends phpbb_database_test_case array( 'style_id' => 2, 'style_name' => 'prosilver2', - 'style_copyright' => '© phpBB Group', + 'style_copyright' => '© phpBB Limited', 'style_active' => 0, 'style_path' => 'prosilver2', 'bbcode_bitfield' => 'kNg=', diff --git a/tests/dbal/schema_test.php b/tests/dbal/schema_test.php index 2a332fddba..f13c7ce032 100644 --- a/tests/dbal/schema_test.php +++ b/tests/dbal/schema_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php index c8cfad04e0..7cac4d6a3b 100644 --- a/tests/dbal/select_test.php +++ b/tests/dbal/select_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/sql_affected_rows_test.php b/tests/dbal/sql_affected_rows_test.php new file mode 100644 index 0000000000..07d7318358 --- /dev/null +++ b/tests/dbal/sql_affected_rows_test.php @@ -0,0 +1,68 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +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/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php index a70eea4f7e..2f9ed0008f 100644 --- a/tests/dbal/sql_insert_buffer_test.php +++ b/tests/dbal/sql_insert_buffer_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2013 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/write_sequence_test.php b/tests/dbal/write_sequence_test.php index 5fe0fe8de9..a1b589c578 100644 --- a/tests/dbal/write_sequence_test.php +++ b/tests/dbal/write_sequence_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php index c069d9a796..2426f2b0be 100644 --- a/tests/dbal/write_test.php +++ b/tests/dbal/write_test.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2008 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ |
