3 require_once(
'./libs/composer/vendor/autoload.php');
27 $stream = Streams::ofString(
'Awesome stuff');
28 $mock = $this->getMockBuilder(\ilVirusScanner::class)
29 ->disableOriginalConstructor()
31 $mock->expects($this->once())->method(
'scanFile')->with($stream->getMetadata(
'uri'))->willReturn(
"Virus found!!!");
34 $result = $subject->process($stream,
new Metadata(
"MyVirus.exe", $stream->getSize(),
'application/vnd.microsoft.portable-executable'));
35 $this->assertSame(ProcessingStatus::DENIED, $result->getCode());
36 $this->assertSame(
'Virus detected.', $result->getMessage());
42 $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(
"");
50 $result = $subject->process($stream,
new Metadata(
"MyVirus.exe", $stream->getSize(),
'application/vnd.microsoft.portable-executable'));
51 $this->assertSame(ProcessingStatus::OK, $result->getCode());
Class VirusScannerPreProcessorTest.