aboutsummaryrefslogtreecommitdiffstats
path: root/tests/attachment
diff options
context:
space:
mode:
Diffstat (limited to 'tests/attachment')
-rw-r--r--tests/attachment/delete_test.php11
-rw-r--r--tests/attachment/manager_test.php2
-rw-r--r--tests/attachment/resync_test.php2
-rw-r--r--tests/attachment/upload_test.php15
4 files changed, 17 insertions, 13 deletions
diff --git a/tests/attachment/delete_test.php b/tests/attachment/delete_test.php
index f1835dd37a..59669c87e9 100644
--- a/tests/attachment/delete_test.php
+++ b/tests/attachment/delete_test.php
@@ -24,6 +24,9 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
/** @var \phpbb\filesystem\filesystem */
protected $filesystem;
+ /** @var \phpbb\event\dispatcher_interface */
+ protected $dispatcher;
+
/** @var \phpbb\attachment\resync */
protected $resync;
@@ -37,9 +40,9 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp()
+ public function setUp(): void
{
- global $db, $phpbb_root_path;
+ global $phpbb_root_path;
parent::setUp();
@@ -47,7 +50,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 +106,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/manager_test.php b/tests/attachment/manager_test.php
index 47d7f38b1d..c440dcf101 100644
--- a/tests/attachment/manager_test.php
+++ b/tests/attachment/manager_test.php
@@ -17,7 +17,7 @@ class phpbb_attachment_manager_test extends \phpbb_test_case
protected $resync;
protected $upload;
- public function setUp()
+ public function setUp(): void
{
$this->delete = $this->getMockBuilder('\phpbb\attachment\delete')
->disableOriginalConstructor()
diff --git a/tests/attachment/resync_test.php b/tests/attachment/resync_test.php
index f882af9ae5..de5ead5bff 100644
--- a/tests/attachment/resync_test.php
+++ b/tests/attachment/resync_test.php
@@ -24,7 +24,7 @@ class phpbb_attachment_resync_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php
index 235ecd082a..a3f51dd34e 100644
--- a/tests/attachment/upload_test.php
+++ b/tests/attachment/upload_test.php
@@ -67,7 +67,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/resync.xml');
}
- public function setUp()
+ public function setUp(): void
{
global $config, $phpbb_root_path, $phpEx;
@@ -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;