aboutsummaryrefslogtreecommitdiffstats
path: root/tests/files
diff options
context:
space:
mode:
Diffstat (limited to 'tests/files')
-rw-r--r--tests/files/types_base_test.php8
-rw-r--r--tests/files/types_form_test.php6
-rw-r--r--tests/files/types_local_test.php4
-rw-r--r--tests/files/types_remote_test.php6
-rw-r--r--tests/files/upload_test.php4
5 files changed, 15 insertions, 13 deletions
diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php
index e630bf8c48..28c5a12c3d 100644
--- a/tests/files/types_base_test.php
+++ b/tests/files/types_base_test.php
@@ -35,11 +35,11 @@ class phpbb_files_types_base_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- protected function setUp()
+ protected function setUp(): void
{
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,10 +75,11 @@ 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);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $php_ini, $this->request);
$type_form = new \phpbb\files\types\local($this->factory, $this->language, $php_ini, $this->request);
$file = $this->getMockBuilder('\phpbb\files\filespec')
->disableOriginalConstructor()
@@ -86,6 +87,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$file->expects($this->any())
->method('get')
->willReturn($filename);
+ $type_form->set_upload($upload);
$type_form->check_upload_size($file);
$this->assertSame($expected, $file->error);
diff --git a/tests/files/types_form_test.php b/tests/files/types_form_test.php
index 925babb47f..ffebcf603f 100644
--- a/tests/files/types_form_test.php
+++ b/tests/files/types_form_test.php
@@ -38,11 +38,11 @@ class phpbb_files_types_form_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- protected function setUp()
+ protected function setUp(): void
{
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..7468e9c4a7 100644
--- a/tests/files/types_local_test.php
+++ b/tests/files/types_local_test.php
@@ -38,11 +38,11 @@ class phpbb_files_types_local_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- protected function setUp()
+ protected function setUp(): void
{
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..d42a609fbb 100644
--- a/tests/files/types_remote_test.php
+++ b/tests/files/types_remote_test.php
@@ -40,14 +40,14 @@ class phpbb_files_types_remote_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- protected function setUp()
+ protected function setUp(): void
{
global $config, $phpbb_root_path, $phpEx;
$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..c8857f863d 100644
--- a/tests/files/upload_test.php
+++ b/tests/files/upload_test.php
@@ -35,7 +35,7 @@ class phpbb_files_upload_test extends phpbb_test_case
/** @var string phpBB root path */
protected $phpbb_root_path;
- protected function setUp()
+ protected function setUp(): void
{
// Global $config required by unique_id
global $config, $phpbb_root_path, $phpEx;
@@ -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));