1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

[ticket/16549] Fix tests

PHPBB3-16549
This commit is contained in:
rxu
2020-08-10 15:02:25 +07:00
parent 342301a1fc
commit 3df19411b4
43 changed files with 351 additions and 54 deletions

View File

@@ -144,6 +144,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->temp = new \phpbb\filesystem\temp($this->filesystem, '');
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
$this->user->data['user_id'] = ANONYMOUS;
$this->upload = new \phpbb\attachment\upload(
$this->auth,
@@ -187,7 +188,14 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
)
),
array('foobar', 1, true,
array(),
// Instead of setting to false or empty array, set default filedata array
// as otherwise it throws PHP undefined array key warnings
// in different file upload related services
array(
'realname' => null,
'type' => null,
'size' => null,
),
array(
'error' => array(
'NOT_UPLOADED',
@@ -250,7 +258,16 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->user
);
$filedata = $this->upload->upload('foobar', 1, true);
// Instead of setting to false or empty array, set default filedata array
// as otherwise it throws PHP undefined array key warnings
// in different file upload related services
$filedata = $this->upload->upload('foobar', 1, true, '', false,
[
'realname' => null,
'type' => null,
'size' => null,
]
);
$this->assertSame(array(
'error' => array(),