mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
[ticket/14972] Migrate from deprecated getMock() method to createMock()
PHPBB3-14972
This commit is contained in:
parent
cdf3aa27df
commit
42b7782927
@ -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())
|
||||
|
@ -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;
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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'),
|
||||
|
6
tests/console/cache/purge_test.php
vendored
6
tests/console/cache/purge_test.php
vendored
@ -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();
|
||||
|
@ -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')
|
||||
);
|
||||
|
@ -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'
|
||||
));
|
||||
|
@ -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'
|
||||
));
|
||||
|
@ -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),
|
||||
|
@ -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'
|
||||
));
|
||||
|
@ -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'
|
||||
));
|
||||
|
@ -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())
|
||||
|
@ -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())
|
||||
|
@ -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())
|
||||
|
@ -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())
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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__) . '/',
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
|
@ -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'
|
||||
);
|
||||
|
@ -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),
|
||||
|
@ -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())
|
||||
|
@ -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')
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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('_'),
|
||||
|
@ -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'
|
||||
));
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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'
|
||||
);
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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');
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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'
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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',
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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();
|
||||
|
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user