1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +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

@@ -186,7 +186,13 @@ class phpbb_fileupload_test extends phpbb_test_case
->set_max_filesize(1000);
copy($this->path . 'jpg', $this->path . 'jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg');
// Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error));
$this->assertFalse($file->additional_checks());
$this->assertTrue($file->move_file('../tests/upload/fixture/copies', true));
@@ -200,7 +206,13 @@ class phpbb_fileupload_test extends phpbb_test_case
->set_max_filesize(1000);
copy($this->path . 'jpg', $this->path . 'jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg');
// Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error));
$this->assertFalse($file->move_file('../tests/upload/fixture'));
$this->assertFalse($file->get('file_moved'));
@@ -215,7 +227,13 @@ class phpbb_fileupload_test extends phpbb_test_case
copy($this->path . 'jpg', $this->path . 'jpg.jpg');
copy($this->path . 'jpg', $this->path . 'copies/jpg.jpg');
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg');
// Upload file data should be set to prevent "Undefined array key" PHP 8 warning
$filedata = [
'size' => 519,
'realname' => $this->path . 'jpg.jpg',
'type' => false,
];
$file = $upload->handle_upload('files.types.local', $this->path . 'jpg.jpg', $filedata);
$this->assertEquals(0, count($file->error));
$file->move_file('../tests/upload/fixture/copies', true);
$this->assertEquals(0, count($file->error));