diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-01-24 12:06:45 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-02-07 14:41:39 +0100 |
commit | 37ae99c75d388221489aa1069078d92eca413741 (patch) | |
tree | c94d5cf5b816e7cfc5bf3e698f63b2b418629268 /tests | |
parent | 4ea90ca44d6d274f1ff6e6e3b4821f9e8cd1e9da (diff) | |
download | forums-37ae99c75d388221489aa1069078d92eca413741.tar forums-37ae99c75d388221489aa1069078d92eca413741.tar.gz forums-37ae99c75d388221489aa1069078d92eca413741.tar.bz2 forums-37ae99c75d388221489aa1069078d92eca413741.tar.xz forums-37ae99c75d388221489aa1069078d92eca413741.zip |
[ticket/10748] Replace direct creations of tools();
PHPBB3-10748
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dbal/auto_increment_test.php | 3 | ||||
-rw-r--r-- | tests/dbal/db_tools_test.php | 3 | ||||
-rw-r--r-- | tests/dbal/migrator_test.php | 3 | ||||
-rw-r--r-- | tests/extension/manager_test.php | 3 | ||||
-rw-r--r-- | tests/extension/metadata_manager_test.php | 3 | ||||
-rw-r--r-- | tests/migrator/convert_timezones_test.php | 9 | ||||
-rw-r--r-- | tests/migrator/schema_generator_test.php | 3 | ||||
-rw-r--r-- | tests/notification/convert_test.php | 3 | ||||
-rw-r--r-- | tests/test_framework/phpbb_database_test_case.php | 5 | ||||
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 8 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 3 |
11 files changed, 32 insertions, 14 deletions
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php index 057bcb5bac..39eb6835ff 100644 --- a/tests/dbal/auto_increment_test.php +++ b/tests/dbal/auto_increment_test.php @@ -30,7 +30,8 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->tools = $factory->get($this->db); $this->table_data = array( 'COLUMNS' => array( diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index c09b34f55c..aa0b6ccf48 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -32,7 +32,8 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->tools = $factory->get($this->db); $this->table_data = array( 'COLUMNS' => array( diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 9b8383fc88..6416a2fcf7 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -38,7 +38,8 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config'); diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index c737d33f95..0126216701 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -150,7 +150,8 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $config = new \phpbb\config\config(array('version' => PHPBB_VERSION)); $db = $this->new_dbal(); - $db_tools = new \phpbb\db\tools\tools($db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db); $phpbb_root_path = __DIR__ . './../../phpBB/'; $php_ext = 'php'; $table_prefix = 'phpbb_'; diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index bd7acf12f9..8514ed3dbd 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -41,7 +41,8 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case 'version' => '3.1.0', )); $this->db = $this->new_dbal(); - $this->db_tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); $this->phpbb_root_path = dirname(__FILE__) . '/'; $this->phpEx = 'php'; $this->user = new \phpbb\user('\phpbb\datetime'); diff --git a/tests/migrator/convert_timezones_test.php b/tests/migrator/convert_timezones_test.php index 80a43b4035..f8d780da0c 100644 --- a/tests/migrator/convert_timezones_test.php +++ b/tests/migrator/convert_timezones_test.php @@ -18,7 +18,8 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case public function getDataSet() { $this->db = $this->new_dbal(); - $db_tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db); // user_dst doesn't exist anymore, must re-add it to test this $db_tools->sql_column_add('phpbb_users', 'user_dst', array('BOOL', 1)); @@ -55,11 +56,12 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case global $phpbb_root_path, $phpEx; $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); $this->migration = new \phpbb\db\migration\data\v310\timezone( new \phpbb\config\config(array()), $this->db, - new \phpbb\db\tools\tools($this->db), + $factory->get($this->db), $phpbb_root_path, $phpEx, 'phpbb_' @@ -90,7 +92,8 @@ class phpbb_migrator_convert_timezones_test extends phpbb_database_test_case } $this->db->sql_freeresult($result); - $db_tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db); // Remove the user_dst field again $db_tools->sql_column_remove('phpbb_users', 'user_dst'); diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php index 1e3b489426..40a8343e22 100644 --- a/tests/migrator/schema_generator_test.php +++ b/tests/migrator/schema_generator_test.php @@ -30,7 +30,8 @@ class schema_generator_test extends phpbb_test_case $this->config = new \phpbb\config\config(array()); $this->db = new \phpbb\db\driver\sqlite(); - $this->db_tools = new \phpbb\db\tools\tools($this->db); + $factory = new \phpbb\db\tools\factory(); + $this->db_tools = $factory->get($this->db); $this->table_prefix = 'phpbb_'; } diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php index ad6e5849d3..4a7fd89409 100644 --- a/tests/notification/convert_test.php +++ b/tests/notification/convert_test.php @@ -28,11 +28,12 @@ class phpbb_notification_convert_test extends phpbb_database_test_case global $phpbb_root_path, $phpEx; $this->db = $this->new_dbal(); + $factory = new \phpbb\db\tools\factory(); $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert( new \phpbb\config\config(array()), $this->db, - new \phpbb\db\tools\tools($this->db), + $factory->get($this->db), $phpbb_root_path, $phpEx, 'phpbb_' diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index f630f4ab52..903158d3c6 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -77,7 +77,10 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test global $table_prefix; $db = new \phpbb\db\driver\sqlite(); - $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); + + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema())); } diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index ba641c6fb7..4f38ccc0d8 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -370,11 +370,15 @@ class phpbb_database_test_connection_manager ->get_classes(); $db = new \phpbb\db\driver\sqlite(); - $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); + + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, $db_tools, $phpbb_root_path, $phpEx, $table_prefix); $db_table_schema = $schema_generator->get_schema(); } - $db_tools = new \phpbb\db\tools\tools($db, true); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db, true); foreach ($db_table_schema as $table_name => $table_data) { $queries = $db_tools->sql_create_table( diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 93876479d5..de18fb2cf2 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -230,7 +230,8 @@ class phpbb_functional_test_case extends phpbb_test_case $config = new \phpbb\config\config(array()); $db = $this->get_db(); - $db_tools = new \phpbb\db\tools\tools($db); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($db); $container = new phpbb_mock_container_builder(); $migrator = new \phpbb\db\migrator( |