1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 03:04:09 +02:00

[ticket/15286] Update tests

PHPBB3-15286
This commit is contained in:
Rubén Calvo
2017-08-09 22:23:23 +02:00
parent a176fa56ef
commit 5111d8a339
9 changed files with 81 additions and 25 deletions

View File

@@ -55,7 +55,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
$this->filesystem->expects($this->any())
->method('exists')
->willReturn(true);
$adapter = new \phpbb\storage\adapter\local($this->filesystem, $phpbb_root_path);
$adapter = new \phpbb\storage\adapter\local($this->filesystem, new \FastImageSize\FastImageSize(), $phpbb_root_path);
$adapter->configure(['path' => 'files']);
$adapter_factory_mock = $this->createMock('\phpbb\storage\adapter_factory');
$adapter_factory_mock->expects($this->any())
@@ -110,6 +110,23 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
*/
public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false)
{
$this->storage = $this->createMock('\phpbb\storage\storage', array('delete', 'exists'));
if ($throw_exception)
{
$this->storage->expects($this->any())
->method('delete')
->willThrowException(new \phpbb\storage\exception\exception);;
}
else
{
$this->storage->expects($this->any())
->method('delete')
->willReturn($remove_success);
}
$this->storage->expects($this->any())
->method('exists')
->willReturn($exists_success);
$this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->resync, $this->storage);
$this->assertSame($expected, $this->attachment_delete->unlink_attachment('foobar'));
}