19 declare(strict_types=1);
30 #[\PHPUnit\Framework\Attributes\BackupGlobals(false)] 31 #[\PHPUnit\Framework\Attributes\BackupStaticProperties(false)] 32 #[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)] 33 #[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses] 40 $stream = Streams::ofString(
'Awesome stuff');
41 $mock = $this->getMockBuilder(\ilVirusScanner::class)
42 ->disableOriginalConstructor()
44 $mock->expects($this->once())->method(
'scanFile')->with($stream->getMetadata(
'uri'))->willReturn(
49 $result = $subject->process(
51 new Metadata(
'MyVirus.exe', $stream->getSize(),
'application/vnd.microsoft.portable-executable')
53 $this->assertSame(ProcessingStatus::DENIED, $result->getCode());
54 $this->assertSame(
'Virus detected.', $result->getMessage());
59 $stream = Streams::ofString(
'Awesome stuff');
61 $mock = $this->getMockBuilder(\ilVirusScanner::class)
62 ->disableOriginalConstructor()
64 $mock->expects($this->once())->method(
'scanFile')->with($stream->getMetadata(
'uri'))->willReturn(
'');
67 $result = $subject->process(
69 new Metadata(
'MyVirus.exe', $stream->getSize(),
'application/vnd.microsoft.portable-executable')
71 $this->assertSame(ProcessingStatus::OK, $result->getCode());