/** * @dataProvider data_attachment_unlink */ public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false) { $this->filesystem = $this->getMock('\\phpbb\\filesystem\\filesystem', array('remove', 'exists')); if ($throw_exception) { $this->filesystem->expects($this->any())->method('remove')->willThrowException(new \phpbb\filesystem\exception\filesystem_exception()); } else { $this->filesystem->expects($this->any())->method('remove')->willReturn($remove_success); } $this->filesystem->expects($this->any())->method('exists')->willReturn($exists_success); $this->attachment_delete = new \phpbb\attachment\delete($this->config, $this->db, $this->dispatcher, $this->filesystem, $this->resync, $this->phpbb_root_path); $this->assertSame($expected, $this->attachment_delete->unlink_attachment('foobar')); }