19require_once(
'./libs/composer/vendor/autoload.php');
 
   24use PHPUnit\Framework\TestCase;
 
   38    use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
 
   43        $stream = Streams::ofString(
'Awesome stuff');
 
   44        $mock = $this->getMockBuilder(\ilVirusScanner::class)
 
   45                     ->disableOriginalConstructor()
 
   47        $mock->expects($this->once())->method(
'scanFile')->with($stream->getMetadata(
'uri'))->willReturn(
"Virus found!!!");
 
   50        $result = $subject->process($stream, 
new Metadata(
"MyVirus.exe", $stream->getSize(), 
'application/vnd.microsoft.portable-executable'));
 
   51        $this->assertSame(ProcessingStatus::DENIED, $result->getCode());
 
   52        $this->assertSame(
'Virus detected.', $result->getMessage());
 
   58        $stream = Streams::ofString(
'Awesome stuff');
 
   60        $mock = $this->getMockBuilder(\ilVirusScanner::class)
 
   61                     ->disableOriginalConstructor()
 
   63        $mock->expects($this->once())->method(
'scanFile')->with($stream->getMetadata(
'uri'))->willReturn(
"");
 
   66        $result = $subject->process($stream, 
new Metadata(
"MyVirus.exe", $stream->getSize(), 
'application/vnd.microsoft.portable-executable'));
 
   67        $this->assertSame(ProcessingStatus::OK, $result->getCode());
 
Class VirusScannerPreProcessorTest.