diff options
70 files changed, 168 insertions, 141 deletions
diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php index f1835dd37a..5ea9f26ea0 100644 --- a/tests/attachment/delete_test.php +++ b/tests/attachment/delete_test.php @@ -47,7 +47,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case $this->db = $this->new_dbal(); $db = $this->db; $this->resync = new \phpbb\attachment\resync($this->db); - $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + $this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); $this->filesystem->expects($this->any()) ->method('remove') ->willReturn(false); @@ -103,7 +103,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case */ public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false) { - $this->filesystem = $this->getMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); + $this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists')); if ($throw_exception) { $this->filesystem->expects($this->any()) diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 235ecd082a..6aaae6ad61 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -81,7 +81,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $config = $this->config; $this->db = $this->new_dbal(); $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -336,14 +336,14 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case */ public function test_image_upload($is_image, $plupload_active, $config_data, $expected) { - $filespec = $this->getMock('\phpbb\files\filespec', - array( + $filespec = $this->getMockBuilder('\phpbb\files\filespec') + ->setMethods(array( 'init_error', 'is_image', 'move_file', 'is_uploaded', - ), - array( + )) + ->setConstructorArgs(array( $this->filesystem, $this->language, $this->php_ini, @@ -351,7 +351,8 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case $this->phpbb_root_path, $this->mimetype_guesser, $this->plupload - )); + )) + ->getMock(); foreach ($config_data as $key => $value) { $this->config[$key] = $value; diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php index 7d77d763fb..f30d19ef9d 100644 --- a/tests/auth/provider_apache_test.php +++ b/tests/auth/provider_apache_test.php @@ -27,7 +27,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case $config = new \phpbb\config\config(array()); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php index 6ff77da564..b7d94ed046 100644 --- a/tests/auth/provider_db_test.php +++ b/tests/auth/provider_db_test.php @@ -37,7 +37,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case )); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); - $request = $this->getMock('\phpbb\request\request'); + $request = $this->createMock('\phpbb\request\request'); $user = new \phpbb\user($lang, '\phpbb\datetime'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index d1e907b53d..68636f2532 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -30,7 +30,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case global $phpbb_root_path, $phpEx; // Mock phpbb_container - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container->expects($this->any()) ->method('get') ->will($this->returnArgument(0)); @@ -39,13 +39,13 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case // Prepare dependencies for avatar manager and driver $this->config = new \phpbb\config\config(array()); - $cache = $this->getMock('\phpbb\cache\driver\driver_interface'); + $cache = $this->createMock('\phpbb\cache\driver\driver_interface'); $path_helper = new \phpbb\path_helper( new \phpbb\symfony_request( new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); @@ -62,12 +62,17 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case $dispatcher = new phpbb_mock_event_dispatcher(); // $this->avatar_foobar will be needed later on - $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); + $this->avatar_foobar = $this->getMockBuilder('\phpbb\avatar\driver\foobar') + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) + ->getMock(); $this->avatar_foobar->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.foobar')); // barfoo driver can't be mocked with constructor arguments - $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name', 'get_config_name')); + $this->avatar_barfoo = $this->getMockBuilder('\phpbb\avatar\driver\barfoo') + ->setMethods(array('get_name', 'get_config_name')) + ->getMock(); $this->avatar_barfoo->expects($this->any()) ->method('get_name') ->will($this->returnValue('avatar.driver.barfoo')); @@ -82,11 +87,17 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case { if ($driver !== 'upload') { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)); + $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $imagesize, $phpbb_root_path, $phpEx, $path_helper, $cache)) + ->getMock(); } else { - $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $dispatcher, $files_factory, $cache)); + $cur_avatar = $this->getMockBuilder('\phpbb\avatar\driver\\' . $driver) + ->setMethods(array('get_name')) + ->setConstructorArgs(array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $dispatcher, $files_factory, $cache)) + ->getMock(); } $cur_avatar->expects($this->any()) ->method('get_name') @@ -288,10 +299,10 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime') - ); + $user = $this->getMockBuilder('\phpbb\user') + ->setMethods(array()) + ->setConstructorArgs(array(new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime')) + ->getMock(); $lang_array = array( array('FOOBAR_OFF', 'foobar_off'), array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'), diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php index 6c92660580..7a7e1dee5c 100644 --- a/tests/console/cache/purge_test.php +++ b/tests/console/cache/purge_test.php @@ -44,10 +44,10 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case $this->cache = new \phpbb\cache\driver\file($this->cache_dir); - $this->db = $this->getMock('\phpbb\db\driver\driver_interface'); + $this->db = $this->createMock('\phpbb\db\driver\driver_interface'); $this->config = new \phpbb\config\config(array('assets_version' => 1)); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); @@ -91,7 +91,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case public function get_command_tester() { $application = new Application(); - $application->add(new purge($this->user, $this->cache, $this->db, $this->getMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); + $application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config)); $command = $application->find('cache:purge'); $this->command_name = $command->getName(); diff --git a/tests/console/config/config_test.php b/tests/console/config/config_test.php index 076316217d..7f8b2efce2 100644 --- a/tests/console/config/config_test.php +++ b/tests/console/config/config_test.php @@ -26,7 +26,7 @@ class phpbb_console_command_config_test extends phpbb_test_case $this->config = new \phpbb\config\config(array()); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index d56d5b040f..bfc897ac2e 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -34,7 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index c4dffa3686..76c7bb27c4 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -40,7 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index e425d998a2..f74ed6ead7 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -50,14 +50,14 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case )); $this->db = $this->db = $this->new_dbal(); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime') ); $this->phpbb_root_path = $phpbb_root_path; $this->phpEx = $phpEx; - $this->cache = $this->getMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); + $this->cache = $this->createMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx)); $this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array( 'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE), 'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE), diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index 5cadc5cc97..6812ea61b8 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -84,7 +84,7 @@ class phpbb_console_command_check_test extends phpbb_test_case $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( $this->language, '\phpbb\datetime' )); diff --git a/tests/console/user/base.php b/tests/console/user/base.php index ad328ac893..c3e40b3cb0 100644 --- a/tests/console/user/base.php +++ b/tests/console/user/base.php @@ -39,7 +39,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $phpbb_container->set('cache.driver', new phpbb_mock_cache()); $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $cache = $phpbb_container->get('cache.driver'); @@ -62,7 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case $this->language->expects($this->any()) ->method('lang') ->will($this->returnArgument(0)); - $user = $this->user = $this->getMock('\phpbb\user', array(), array( + $user = $this->user = $this->createMock('\phpbb\user', array(), array( $this->language, '\phpbb\datetime' )); diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php index 4ea95b0a96..4f978219c2 100644 --- a/tests/content_visibility/delete_post_test.php +++ b/tests/content_visibility/delete_post_test.php @@ -299,7 +299,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php index 6c5066119e..fde2b62131 100644 --- a/tests/content_visibility/get_forums_visibility_sql_test.php +++ b/tests/content_visibility/get_forums_visibility_sql_test.php @@ -129,7 +129,7 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php index 9ae4182673..eced3aa680 100644 --- a/tests/content_visibility/get_global_visibility_sql_test.php +++ b/tests/content_visibility/get_global_visibility_sql_test.php @@ -129,7 +129,7 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_getf') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php index aaaf64330e..18802fadbc 100644 --- a/tests/content_visibility/get_visibility_sql_test.php +++ b/tests/content_visibility/get_visibility_sql_test.php @@ -76,7 +76,7 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te $db = $this->new_dbal(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php index e33a1f30d5..8f629dca62 100644 --- a/tests/content_visibility/set_post_visibility_test.php +++ b/tests/content_visibility/set_post_visibility_test.php @@ -120,7 +120,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); @@ -173,7 +173,7 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php index 78431396c3..3db79c0fe0 100644 --- a/tests/content_visibility/set_topic_visibility_test.php +++ b/tests/content_visibility/set_topic_visibility_test.php @@ -84,7 +84,7 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_ $cache = new phpbb_mock_cache; $db = $this->new_dbal(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php index 0365463a48..818d8d8e17 100644 --- a/tests/dbal/db_tools_test.php +++ b/tests/dbal/db_tools_test.php @@ -346,10 +346,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_perform_schema_changes_drop_tables() { - $db_tools = $this->getMock('\phpbb\db\tools\tools', array( - 'sql_table_exists', - 'sql_table_drop', - ), array(&$this->db)); + $db_tools = $this->getMockBuilder('\phpbb\db\tools\tools') + ->setMethods(array('sql_table_exists', 'sql_table_drop')) + ->setConstructorArgs(array(&$this->db)) + ->getMock(); // pretend all tables exist $db_tools->expects($this->any())->method('sql_table_exists') @@ -372,10 +372,10 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case public function test_perform_schema_changes_drop_columns() { - $db_tools = $this->getMock('\phpbb\db\tools\tools', array( - 'sql_column_exists', - 'sql_column_remove', - ), array(&$this->db)); + $db_tools = $this->getMockBuilder('\phpbb\db\tools\tools') + ->setMethods(array('sql_column_exists', 'sql_column_remove')) + ->setConstructorArgs(array(&$this->db)) + ->getMock(); // pretend all columns exist $db_tools->expects($this->any())->method('sql_column_exists') diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php index e34ee7b59c..46045d2371 100644 --- a/tests/dbal/migrator_tool_module_test.php +++ b/tests/dbal/migrator_tool_module_test.php @@ -39,7 +39,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); // Correctly set the root path for this test to this directory, so the classes can be found diff --git a/tests/event/exception_listener_test.php b/tests/event/exception_listener_test.php index 08679a3ed8..fbae9e25b7 100644 --- a/tests/event/exception_listener_test.php +++ b/tests/event/exception_listener_test.php @@ -84,7 +84,7 @@ class exception_listener extends phpbb_test_case $exception_listener = new \phpbb\event\kernel_exception_subscriber($template, $lang); - $event = new \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent($this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); + $event = new \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent($this->createMock('Symfony\Component\HttpKernel\HttpKernelInterface'), $request, \Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST, $exception); $exception_listener->on_kernel_exception($event); $response = $event->getResponse(); diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 533da68c57..bb272b4df3 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -59,7 +59,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, $this->phpEx ); diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php index 88634bc6ba..20b71e2812 100644 --- a/tests/extension/modules_test.php +++ b/tests/extension/modules_test.php @@ -46,7 +46,7 @@ class phpbb_extension_modules_test extends phpbb_test_case $this->module_manager = new \phpbb\module\module_manager( new \phpbb\cache\driver\dummy(), - $this->getMock('\phpbb\db\driver\driver_interface'), + $this->createMock('\phpbb\db\driver\driver_interface'), $this->extension_manager, MODULES_TABLE, dirname(__FILE__) . '/', diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php index e630bf8c48..3b1cf68d50 100644 --- a/tests/files/types_base_test.php +++ b/tests/files/types_base_test.php @@ -39,7 +39,7 @@ class phpbb_files_types_base_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -75,7 +75,7 @@ class phpbb_files_types_base_test extends phpbb_test_case */ public function test_check_upload_size($filename, $max_filesize, $expected) { - $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper'); + $php_ini = $this->createMock('\bantu\IniGetWrapper\IniGetWrapper'); $php_ini->expects($this->any()) ->method('getString') ->willReturn($max_filesize); diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php index 925babb47f..25d79f6117 100644 --- a/tests/files/types_form_test.php +++ b/tests/files/types_form_test.php @@ -42,7 +42,7 @@ class phpbb_files_types_form_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn(array()); @@ -137,7 +137,7 @@ class phpbb_files_types_form_test extends phpbb_test_case */ public function test_upload_form($upload, $expected, $plupload = array()) { - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn($upload); diff --git a/tests/files/types_local_test.php b/tests/files/types_local_test.php index 31070de107..67e4c571f5 100644 --- a/tests/files/types_local_test.php +++ b/tests/files/types_local_test.php @@ -42,7 +42,7 @@ class phpbb_files_types_local_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->request->expects($this->any()) ->method('file') ->willReturn(array()); diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php index 1a7d63d790..85ec2a528b 100644 --- a/tests/files/types_remote_test.php +++ b/tests/files/types_remote_test.php @@ -47,7 +47,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $config = new \phpbb\config\config(array()); $this->config = $config; $this->config->set('remote_upload_verify', 0); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); @@ -102,7 +102,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case */ public function test_get_max_file_size($max_file_size, $link, $expected = array('URL_NOT_FOUND')) { - $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); + $php_ini = $this->createMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); $php_ini->expects($this->any()) ->method('getString') ->willReturn($max_file_size); diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index c41204a0d5..a9c2dca9d9 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -48,7 +48,7 @@ class phpbb_files_upload_test extends phpbb_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php index 426ebcee53..4fced5700a 100644 --- a/tests/functional/fileupload_remote_test.php +++ b/tests/functional/fileupload_remote_test.php @@ -54,7 +54,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case $this->filesystem = new \phpbb\filesystem\filesystem(); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $container = new phpbb_mock_container_builder(); diff --git a/tests/functions/build_url_test.php b/tests/functions/build_url_test.php index 91a4a9ec66..a528cec5ae 100644 --- a/tests/functions/build_url_test.php +++ b/tests/functions/build_url_test.php @@ -28,7 +28,7 @@ class phpbb_build_url_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, 'php' ); diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php index 778753e5d2..77b1079802 100644 --- a/tests/functions/obtain_online_test.php +++ b/tests/functions/obtain_online_test.php @@ -162,7 +162,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case $config['load_online_guests'] = $display_guests; $user = new phpbb_mock_lang(); $user->lang = $this->load_language(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $acl_get_map = array( array('u_viewonline', true), array('u_viewprofile', true), diff --git a/tests/functions_content/get_username_string_test.php b/tests/functions_content/get_username_string_test.php index e79342d05d..ac36e37e93 100644 --- a/tests/functions_content/get_username_string_test.php +++ b/tests/functions_content/get_username_string_test.php @@ -18,7 +18,7 @@ class phpbb_functions_content_get_username_string_test extends phpbb_test_case parent::setUp(); global $auth, $phpbb_dispatcher, $user; - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), $this->anything()) diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php index 3124d57ba0..6968b1cd3a 100644 --- a/tests/functions_user/group_user_attributes_test.php +++ b/tests/functions_user/group_user_attributes_test.php @@ -134,11 +134,11 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes $cache = new phpbb_mock_cache; $db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_clear_prefetch'); $cache_driver = new \phpbb\cache\driver\dummy(); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) ->method('get') diff --git a/tests/installer/installer_config_test.php b/tests/installer/installer_config_test.php index 13ac325a79..1193d7aee4 100644 --- a/tests/installer/installer_config_test.php +++ b/tests/installer/installer_config_test.php @@ -23,8 +23,9 @@ class phpbb_installer_config_test extends phpbb_test_case public function setUp() { $phpbb_root_path = __DIR__ . './../../phpBB/'; - $filesystem = $this->getMock('\phpbb\filesystem\filesystem'); + $filesystem = $this->createMock('\phpbb\filesystem\filesystem'); $php_ini = $this->getMockBuilder('\bantu\IniGetWrapper\IniGetWrapper') + ->setMethods(array('getInt', 'getBytes')) ->getMock(); $php_ini->method('getInt') ->willReturn(-1); diff --git a/tests/installer/module_base_test.php b/tests/installer/module_base_test.php index 9578010047..71ec2b8db2 100644 --- a/tests/installer/module_base_test.php +++ b/tests/installer/module_base_test.php @@ -42,7 +42,7 @@ class module_base_test extends phpbb_test_case $this->module = new test_installer_module($module_collection, true, false); - $iohandler = $this->getMock('\phpbb\install\helper\iohandler\iohandler_interface'); + $iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface'); $config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php'); $this->module->setup($config, $iohandler); } diff --git a/tests/log/add_test.php b/tests/log/add_test.php index 604c8364dc..469d4ebd69 100644 --- a/tests/log/add_test.php +++ b/tests/log/add_test.php @@ -28,7 +28,7 @@ class phpbb_log_add_test extends phpbb_database_test_case $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); @@ -59,7 +59,7 @@ class phpbb_log_add_test extends phpbb_database_test_case $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php index e8b75d01d9..04aa20d9ce 100644 --- a/tests/log/delete_test.php +++ b/tests/log/delete_test.php @@ -30,7 +30,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->data['user_id'] = 1; - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php index 3b5537fc13..c3f1a0beba 100644 --- a/tests/log/function_add_log_test.php +++ b/tests/log/function_add_log_test.php @@ -159,11 +159,11 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case $db = $this->new_dbal(); $cache = new phpbb_mock_cache; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index ee9c3e5893..1f9717203c 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -378,7 +378,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); // Create auth mock - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $acl_get_map = array( array('f_read', 23, true), array('m_', 23, true), diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index 21559c42a5..baa90f29b1 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -58,7 +58,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $db = $this->db; // Auth - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), @@ -92,7 +92,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)); // User - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( $lang, '\phpbb\datetime' )); @@ -105,8 +105,8 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c ); // Request - $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); - $request = $this->getMock('\phpbb\request\request'); + $type_cast_helper = $this->createMock('\phpbb\request\type_cast_helper_interface'); + $request = $this->createMock('\phpbb\request\request'); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php index f14f305517..a51f0780b1 100644 --- a/tests/notification/submit_post_type_topic_test.php +++ b/tests/notification/submit_post_type_topic_test.php @@ -42,7 +42,7 @@ class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_ ), ))); - $phpbb_log = $this->getMock('\phpbb\log\dummy'); + $phpbb_log = $this->createMock('\phpbb\log\dummy'); } /** diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php index 7d4dff6024..0de6294491 100644 --- a/tests/notification/user_list_trim_test.php +++ b/tests/notification/user_list_trim_test.php @@ -39,7 +39,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case $phpEx ); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $auth->expects($this->any()) ->method('acl_get') ->with($this->stringContains('_'), diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 2d7d1671a8..3b1f1a45c3 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -29,7 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case global $phpbb_dispatcher, $phpbb_root_path, $phpEx; $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 0410d7035f..40e2849f9c 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -361,13 +361,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case { if ($use_new_interface) { - $test_driver = $this->getMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); $test_driver->method('needs_rehash') ->willReturn($needs_rehash); } else { - $test_driver = $this->getMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); + $test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only')); } $config = new \phpbb\config\config(array()); diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php index 49dd40fbec..585d62847e 100644 --- a/tests/path_helper/path_helper_test.php +++ b/tests/path_helper/path_helper_test.php @@ -29,7 +29,7 @@ class phpbb_path_helper_test extends phpbb_test_case new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); @@ -180,7 +180,7 @@ class phpbb_path_helper_test extends phpbb_test_case */ public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction) { - $symfony_request = $this->getMock('\phpbb\symfony_request', array(), array( + $symfony_request = $this->createMock('\phpbb\symfony_request', array(), array( new phpbb_mock_request(), )); $symfony_request->expects($this->any()) @@ -196,7 +196,7 @@ class phpbb_path_helper_test extends phpbb_test_case $path_helper = new \phpbb\path_helper( $symfony_request, new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php index 10239172c3..66e1578e8a 100644 --- a/tests/profilefields/type_bool_test.php +++ b/tests/profilefields/type_bool_test.php @@ -27,15 +27,17 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $db = $this->createMock('phpbb\\db\\driver\\driver'); + + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') + ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->setConstructorArgs(array($db, LANG_TABLE)) + ->getMock(); $lang->expects($this->any()) ->method('get_options_lang'); @@ -48,8 +50,8 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case ->method('get') ->will($this->returnCallback(array($this, 'get'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_bool( $lang, diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index e0807b2f9b..dc547c2d10 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -27,7 +27,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -45,8 +45,8 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case 'DATE_FORMAT' => 'm/d/Y', ); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_date( $request, diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php index ab02353fb9..96b2ad31be 100644 --- a/tests/profilefields/type_dropdown_test.php +++ b/tests/profilefields/type_dropdown_test.php @@ -27,18 +27,20 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( - new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), - '\phpbb\datetime' - )); + $db = $this->createMock('phpbb\\db\\driver\\driver'); + + $user = $this->createMock('\phpbb\user'); $user->expects($this->any()) ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); - $lang = $this->getMock('\phpbb\profilefields\lang_helper', array(), array(null, null)); + $lang = $this->getMockBuilder('\phpbb\profilefields\lang_helper') + ->setMethods(array('get_options_lang', 'is_set', 'get')) + ->setConstructorArgs(array($db, LANG_TABLE)) + ->getMock(); $lang->expects($this->any()) ->method('get_options_lang'); diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php index 9222362214..06ba231e68 100644 --- a/tests/profilefields/type_googleplus_test.php +++ b/tests/profilefields/type_googleplus_test.php @@ -25,8 +25,8 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case $lang = new \phpbb\language\language($lang_loader); $user = new \phpbb\user($lang, '\phpbb\datetime'); $user->add_lang('ucp'); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->field = new \phpbb\profilefields\type\type_googleplus( $request, diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index 33f3f575c8..326c6051b3 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -26,7 +26,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case { global $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -34,8 +34,8 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_int( $request, diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index 54bb406838..946e513e96 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -26,7 +26,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case { global $config, $request, $user, $cache, $phpbb_root_path, $phpEx; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -36,8 +36,8 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case ->will($this->returnCallback(array($this, 'return_callback_implode'))); $config = new \phpbb\config\config([]); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_string( $request, diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php index 3bb5d52899..18aa214e3d 100644 --- a/tests/profilefields/type_url_test.php +++ b/tests/profilefields/type_url_test.php @@ -32,7 +32,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case $config = new \phpbb\config\config([]); $cache = new phpbb_mock_cache; - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); @@ -40,8 +40,8 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); - $request = $this->getMock('\phpbb\request\request'); - $template = $this->getMock('\phpbb\template\template'); + $request = $this->createMock('\phpbb\request\request'); + $template = $this->createMock('\phpbb\template\template'); $this->cp = new \phpbb\profilefields\type\type_url( $request, diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php index d45f9ca666..eabc79ed96 100644 --- a/tests/request/deactivated_super_global_test.php +++ b/tests/request/deactivated_super_global_test.php @@ -19,7 +19,7 @@ class phpbb_deactivated_super_global_test extends phpbb_test_case public function test_write_triggers_error() { $this->setExpectedTriggerError(E_USER_ERROR); - $obj = new \phpbb\request\deactivated_super_global($this->getMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST); + $obj = new \phpbb\request\deactivated_super_global($this->createMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST); $obj->offsetSet(0, 0); } } diff --git a/tests/request/request_test.php b/tests/request/request_test.php index ebaea1f9ef..47798177e1 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -39,7 +39,7 @@ class phpbb_request_test extends phpbb_test_case $_SERVER['HTTP_ACCEPT'] = 'application/json'; $_SERVER['HTTP_SOMEVAR'] = '<value>'; - $this->type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface'); + $this->type_cast_helper = $this->createMock('\phpbb\request\type_cast_helper_interface'); $this->request = new \phpbb\request\request($this->type_cast_helper); } diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php index 84d4fcf479..113c32bf7f 100644 --- a/tests/security/hash_test.php +++ b/tests/security/hash_test.php @@ -18,7 +18,7 @@ class phpbb_security_hash_test extends phpbb_test_case global $phpbb_container; $config = new \phpbb\config\config(array()); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $driver_helper = new \phpbb\passwords\driver\helper($config); $passwords_drivers = array( 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php index 0177eb4259..0d08eaeac1 100644 --- a/tests/security/redirect_test.php +++ b/tests/security/redirect_test.php @@ -67,7 +67,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $this->phpbb_root_path, 'php' ); diff --git a/tests/template/template_allfolder_test.php b/tests/template/template_allfolder_test.php index 63a6ef08ea..e7e4f21321 100644 --- a/tests/template/template_allfolder_test.php +++ b/tests/template/template_allfolder_test.php @@ -40,7 +40,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 3a93c91e11..6bd4180e09 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -145,7 +145,7 @@ Zeta test event in all', new phpbb_mock_request() ), new \phpbb\filesystem\filesystem(), - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index 4eb30eda1e..042c017878 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -35,7 +35,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php index 8adbafb1b2..78fa59c956 100644 --- a/tests/template/template_test_case.php +++ b/tests/template/template_test_case.php @@ -87,7 +87,7 @@ class phpbb_template_template_test_case extends phpbb_test_case new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 75e3918f44..b0c362b8d0 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -29,7 +29,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat new phpbb_mock_request() ), $filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 4d294fd523..9351ab3f4a 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -632,11 +632,11 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; @@ -674,17 +674,17 @@ class phpbb_functional_test_case extends phpbb_test_case $db = $this->get_db(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); - $user = $this->getMock('\phpbb\user', array(), array( + $user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); - $auth = $this->getMock('\phpbb\auth\auth'); + $auth = $this->createMock('\phpbb\auth\auth'); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); $cache = new phpbb_mock_null_cache; $cache_driver = new \phpbb\cache\driver\dummy(); - $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container = $this->createMock('Symfony\Component\DependencyInjection\ContainerInterface'); $phpbb_container ->expects($this->any()) ->method('get') diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index b3d7780d14..1e71ca6e69 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -37,7 +37,7 @@ abstract class phpbb_session_test_case extends phpbb_database_test_case $phpbb_path_helper = new \phpbb\path_helper( $symfony_request, $phpbb_filesystem, - $this->getMock('\phpbb\request\request'), + $this->createMock('\phpbb\request\request'), $phpbb_root_path, $phpEx ); diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index c792976b1e..c8ff7ba72b 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -382,10 +382,16 @@ class phpbb_test_case_helpers } // Mock the DAL, make it return data from the fixture + $db_driver = $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver') + ->disableOriginalConstructor() + ->disableOriginalClone() + ->disableArgumentCloning() + ->disallowMockingUnknownTypes() + ->getMock(); $mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access'); $mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles')); $mb->setConstructorArgs(array( - $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')->getMock(), + $db_driver, 'phpbb_bbcodes', 'phpbb_smilies', 'phpbb_styles', diff --git a/tests/text_formatter/s9e/factory_test.php b/tests/text_formatter/s9e/factory_test.php index 0d780a19a9..1505609684 100644 --- a/tests/text_formatter/s9e/factory_test.php +++ b/tests/text_formatter/s9e/factory_test.php @@ -286,7 +286,7 @@ class phpbb_textformatter_s9e_factory_test extends phpbb_database_test_case */ public function test_configure_events() { - $this->dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $this->dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $this->dispatcher ->expects($this->at(0)) ->method('trigger_event') diff --git a/tests/text_formatter/s9e/parser_test.php b/tests/text_formatter/s9e/parser_test.php index 4b9bbf9bb2..e10ebd29ee 100644 --- a/tests/text_formatter/s9e/parser_test.php +++ b/tests/text_formatter/s9e/parser_test.php @@ -19,7 +19,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case ->disableOriginalConstructor() ->getMock(); - $cache = $this->getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_parser') @@ -172,7 +172,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case public function test_setup_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->once()) ->method('trigger_event') @@ -202,7 +202,7 @@ class phpbb_textformatter_s9e_parser_test extends phpbb_test_case public function test_parse_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->any()) ->method('trigger_event') diff --git a/tests/text_formatter/s9e/renderer_test.php b/tests/text_formatter/s9e/renderer_test.php index 175b90fdc7..672069590a 100644 --- a/tests/text_formatter/s9e/renderer_test.php +++ b/tests/text_formatter/s9e/renderer_test.php @@ -26,7 +26,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case '<?php class renderer_foo { public function setParameter() {} }' ); - $cache = $this->getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_renderer') @@ -50,7 +50,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case { $mock = $this->getMockForAbstractClass('s9e\\TextFormatter\\Renderer'); - $cache = $this->getMock('phpbb_mock_cache'); + $cache = $this->createMock('phpbb_mock_cache'); $cache->expects($this->once()) ->method('get') ->with('_foo_renderer') @@ -197,7 +197,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case $config = new \phpbb\config\config(array('allow_nocensors' => true)); - $auth = $test->getMock('phpbb\\auth\\auth'); + $auth = $test->createMock('phpbb\\auth\\auth'); $auth->expects($test->any()) ->method('acl_get') ->with('u_chgcensors') @@ -393,7 +393,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case public function test_setup_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->once()) ->method('trigger_event') @@ -424,7 +424,7 @@ class phpbb_textformatter_s9e_renderer_test extends phpbb_test_case public function test_render_event() { $container = $this->get_test_case_helpers()->set_s9e_services(); - $dispatcher = $this->getMock('phpbb\\event\\dispatcher_interface'); + $dispatcher = $this->createMock('phpbb\\event\\dispatcher_interface'); $dispatcher ->expects($this->any()) ->method('trigger_event') diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php index 86bc803c98..22d6d26c75 100644 --- a/tests/text_processing/generate_text_for_display_test.php +++ b/tests/text_processing/generate_text_for_display_test.php @@ -77,7 +77,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca $config = new \phpbb\config\config(array('allow_nocensors' => true)); - $auth = $this->getMock('phpbb\\auth\\auth'); + $auth = $this->createMock('phpbb\\auth\\auth'); $auth->expects($this->any()) ->method('acl_get') ->with('u_chgcensors') diff --git a/tests/upload/fileupload_test.php b/tests/upload/fileupload_test.php index 76b899cca7..84fc00bf98 100644 --- a/tests/upload/fileupload_test.php +++ b/tests/upload/fileupload_test.php @@ -50,7 +50,7 @@ class phpbb_fileupload_test extends phpbb_test_case $config['rand_seed'] = ''; $config['rand_seed_last_update'] = time() + 600; - $this->request = $this->getMock('\phpbb\request\request'); + $this->request = $this->createMock('\phpbb\request\request'); $this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $this->filesystem = new \phpbb\filesystem\filesystem(); diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php index 35c3d92a3a..7b8d71181f 100644 --- a/tests/version/version_helper_remote_test.php +++ b/tests/version/version_helper_remote_test.php @@ -30,7 +30,11 @@ class version_helper_remote_test extends \phpbb_test_case )); $container = new \phpbb_mock_container_builder(); $db = new \phpbb\db\driver\factory($container); - $this->cache = $this->getMock('\phpbb\cache\service', array('get'), array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')); + $this->cache = $this->getMockBuilder('\phpbb\cache\service') + ->setMethods(array('get')) + ->setConstructorArgs(array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')) + ->getMock(); + $this->cache->expects($this->any()) ->method('get') ->with($this->anything()) |