1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 21:54:00 +02:00

[ticket/16345] Small improvements

PHPBB3-16346
This commit is contained in:
rubencm
2020-06-07 02:15:35 +00:00
parent 3cceeb45bf
commit 774c609c4a
284 changed files with 1380 additions and 835 deletions

View File

@@ -13,8 +13,7 @@
class phpbb_files_upload_test extends phpbb_test_case
{
private $path;
/** @var \phpbb\filesystem\filesystem */
private $filesystem;
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
@@ -66,13 +65,12 @@ class phpbb_files_upload_test extends phpbb_test_case
))));
$this->factory = new \phpbb\files\factory($this->container);
$this->path = __DIR__ . '/fixture/';
$this->phpbb_root_path = $phpbb_root_path;
}
public function test_reset_vars()
{
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload->set_max_filesize(500);
$this->assertEquals(500, $upload->max_filesize);
$upload->reset_vars();
@@ -81,7 +79,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_set_disallowed_content()
{
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$disallowed_content = new ReflectionProperty($upload, 'disallowed_content');
$disallowed_content->setAccessible(true);
@@ -89,7 +87,7 @@ class phpbb_files_upload_test extends phpbb_test_case
$this->assertEquals(array('foo'), $disallowed_content->getValue($upload));
$upload->set_disallowed_content(array('foo', 'bar', 'meh'));
$this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload));
$upload->set_disallowed_content('');
$upload->set_disallowed_content(false);
$this->assertEquals(array('foo', 'bar', 'meh'), $disallowed_content->getValue($upload));
$this->assertINstanceOf('\phpbb\files\upload', $upload->set_disallowed_content(array()));
$this->assertEquals(array(), $disallowed_content->getValue($upload));
@@ -99,7 +97,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_is_valid()
{
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$this->assertFalse($upload->is_valid('foobar'));
}
@@ -122,7 +120,7 @@ class phpbb_files_upload_test extends phpbb_test_case
*/
public function test_assign_internal_error($error_code, $expected)
{
$upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
$this->assertSame($expected, $upload->assign_internal_error($error_code));
}
}