mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-08 17:56:52 +02:00
[ticket/15692] Update tests
PHPBB3-15692
This commit is contained in:
@@ -21,9 +21,6 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\filesystem\filesystem */
|
||||
protected $filesystem;
|
||||
|
||||
/** @var \phpbb\attachment\resync */
|
||||
protected $resync;
|
||||
|
||||
@@ -47,22 +44,11 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
|
||||
$cache = $this->createMock('\phpbb\cache\driver\driver_interface');
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
$this->db = $this->new_dbal();
|
||||
$db_mock = $this->createMock('\phpbb\db\driver\driver_interface');
|
||||
$this->resync = new \phpbb\attachment\resync($this->db);
|
||||
$this->filesystem = $this->createMock('\phpbb\filesystem\filesystem', array('remove', 'exists'));
|
||||
$this->filesystem->expects($this->any())
|
||||
->method('remove')
|
||||
->willReturn(false);
|
||||
$this->filesystem->expects($this->any())
|
||||
$this->storage = $this->createMock('\phpbb\storage\storage');
|
||||
$this->storage->expects($this->any())
|
||||
->method('exists')
|
||||
->willReturn(true);
|
||||
$adapter = new \phpbb\storage\adapter\local($this->filesystem, new \FastImageSize\FastImageSize(), new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)), $phpbb_root_path);
|
||||
$adapter->configure(['path' => 'files']);
|
||||
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
|
||||
$adapter_factory_mock->expects($this->any())
|
||||
->method('get')
|
||||
->willReturn($adapter);
|
||||
$this->storage = new \phpbb\storage\storage($db_mock, $cache, $adapter_factory_mock, '', '');
|
||||
$this->dispatcher = new \phpbb_mock_event_dispatcher();
|
||||
$this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->resync, $this->storage);
|
||||
}
|
||||
|
@@ -86,9 +86,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
||||
));
|
||||
$config = $this->config;
|
||||
$this->db = $this->new_dbal();
|
||||
$db_mock = $this->createMock('\phpbb\db\driver\driver_interface');
|
||||
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx);
|
||||
$cache_mock = $this->createMock('\phpbb\cache\driver\driver_interface');
|
||||
$this->request = $this->createMock('\phpbb\request\request');
|
||||
|
||||
$this->filesystem = new \phpbb\filesystem\filesystem();
|
||||
@@ -105,13 +103,10 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
||||
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
|
||||
$this->plupload = new \phpbb\plupload\plupload($phpbb_root_path, $this->config, $this->request, new \phpbb\user($this->language, '\phpbb\datetime'), $this->php_ini, $this->mimetype_guesser);
|
||||
|
||||
$adapter = new \phpbb\storage\adapter\local($this->filesystem, new \FastImageSize\FastImageSize(), new \phpbb\mimetype\guesser(array(new \phpbb\mimetype\extension_guesser)), $phpbb_root_path);
|
||||
$adapter->configure(['path' => 'files']);
|
||||
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
|
||||
$adapter_factory_mock->expects($this->any())
|
||||
->method('get')
|
||||
->willReturn($adapter);
|
||||
$this->storage = new \phpbb\storage\storage($db_mock, $cache_mock, $adapter_factory_mock, '', '');
|
||||
$this->storage = $this->createMock('\phpbb\storage\storage');
|
||||
$this->storage->expects($this->any())
|
||||
->method('free_space')
|
||||
->willReturn(1024*1024); // 1gb
|
||||
|
||||
$factory_mock = $this->getMockBuilder('\phpbb\files\factory')
|
||||
->disableOriginalConstructor()
|
||||
|
Reference in New Issue
Block a user