mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16345] Small improvements
PHPBB3-16346
This commit is contained in:
@@ -17,6 +17,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
{
|
||||
private $path;
|
||||
|
||||
/** @var \phpbb\filesystem\filesystem */
|
||||
private $filesystem;
|
||||
|
||||
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
|
||||
@@ -37,6 +38,8 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
protected $mimetype_guesser;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
// Global $config required by unique_id
|
||||
@@ -117,7 +120,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_invalid_extension()
|
||||
{
|
||||
$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_allowed_extensions(array('png'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -127,7 +130,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_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);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
$file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path);
|
||||
@@ -146,7 +149,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_invalid_filename()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -157,7 +160,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_too_large()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -168,7 +171,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_valid_file()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -178,7 +181,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_local_upload()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -192,7 +195,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_move_existent_file()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -206,7 +209,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_move_existent_file_overwrite()
|
||||
{
|
||||
$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_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -221,7 +224,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_valid_dimensions()
|
||||
{
|
||||
$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);
|
||||
$upload->set_allowed_extensions(false)
|
||||
->set_max_filesize(false)
|
||||
->set_allowed_dimensions(1, 1, 100, 100);
|
||||
|
Reference in New Issue
Block a user