mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/13904] No longer use fileerror class for extending filespec class
PHPBB3-13904
This commit is contained in:
@@ -22,6 +22,12 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
private $filesystem;
|
||||
|
||||
/** @var \Symfony\Component\DependencyInjection\ContainerInterface */
|
||||
protected $container;
|
||||
|
||||
/** @var \phpbb\files\factory */
|
||||
protected $factory;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
// Global $config required by unique_id
|
||||
@@ -44,12 +50,13 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
$this->filesystem = $phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
||||
|
||||
$phpbb_container = new phpbb_mock_container_builder($this->phpbb_root_path, $this->phpEx);
|
||||
$phpbb_container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->container = new phpbb_mock_container_builder($this->phpbb_root_path, $this->phpEx);
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
new \phpbb\mimetype\guesser(array(
|
||||
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
|
||||
))));
|
||||
$this->factory = new \phpbb\files\factory($this->container);
|
||||
|
||||
$this->path = __DIR__ . '/fixture/';
|
||||
}
|
||||
@@ -76,7 +83,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_invalid_extension()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('png'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -86,7 +93,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_invalid_filename()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -97,7 +104,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_too_large()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -108,7 +115,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_common_checks_valid_file()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
$file = $this->gen_valid_filespec();
|
||||
@@ -118,7 +125,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_local_upload()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -130,7 +137,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_move_existent_file()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -144,7 +151,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_move_existent_file_overwrite()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
@@ -159,7 +166,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
||||
|
||||
public function test_valid_dimensions()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->filesystem);
|
||||
$upload = new \phpbb\files\upload($this->filesystem, $this->factory);
|
||||
$upload->set_allowed_extensions(false)
|
||||
->set_max_filesize(false)
|
||||
->set_allowed_dimensions(1, 1, 100, 100);
|
||||
|
Reference in New Issue
Block a user