Class VirusScannerPreProcessorTest.
More...
Class VirusScannerPreProcessorTest.
- Author
- Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
@runTestsInSeparateProcesses @preserveGlobalState disabled @backupGlobals disabled @backupStaticAttributes disabled
Definition at line 36 of file VirusScannerPreProcessorTest.php.
◆ testNoVirusDetected()
| VirusScannerPreProcessorTest::testNoVirusDetected |
( |
| ) |
|
Definition at line 56 of file VirusScannerPreProcessorTest.php.
57 {
58 $stream = Streams::ofString('Awesome stuff');
59
60 $mock = $this->getMockBuilder(\ilVirusScanner::class)
61 ->disableOriginalConstructor()
62 ->getMock();
63 $mock->expects($this->once())->method('scanFile')->with($stream->getMetadata('uri'))->willReturn("");
64
66 $result = $subject->process($stream,
new Metadata(
"MyVirus.exe", $stream->getSize(),
'application/vnd.microsoft.portable-executable'));
67 $this->assertSame(ProcessingStatus::OK, $result->getCode());
68 }
◆ testVirusDetected()
| VirusScannerPreProcessorTest::testVirusDetected |
( |
| ) |
|
Definition at line 41 of file VirusScannerPreProcessorTest.php.
42 {
43 $stream = Streams::ofString('Awesome stuff');
44 $mock = $this->getMockBuilder(\ilVirusScanner::class)
45 ->disableOriginalConstructor()
46 ->getMock();
47 $mock->expects($this->once())->method('scanFile')->with($stream->getMetadata('uri'))->willReturn("Virus found!!!");
48
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());
53 }
The documentation for this class was generated from the following file: