5require_once(
'./libs/composer/vendor/autoload.php');
11use PHPUnit\Framework\TestCase;
25 use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
31 $mock = Mockery::mock(\ilVirusScanner::class);
33 $mock->shouldReceive(
"scanFile")->once()->withArgs(array( $stream->getMetadata(
'uri') ))->andReturn(
"Virus found!!!");
36 $result = $subject->process($stream,
new Metadata(
"MyVirus.exe", $stream->getSize(),
'application/vnd.microsoft.portable-executable'));
38 $this->assertSame(
'Virus detected.',
$result->getMessage());
45 $mock = Mockery::mock(\ilVirusScanner::class);
47 $mock->shouldReceive(
"scanFile")->once()->withArgs(array( $stream->getMetadata(
'uri') ))->andReturn(
"");
50 $result = $subject->process($stream,
new Metadata(
"MyVirus.exe", $stream->getSize(),
'application/vnd.microsoft.portable-executable'));
An exception for terminatinating execution or to throw for unit testing.
const REJECTED
Upload got rejected by a processor.
Class VirusScannerPreProcessorTest.
Class VirusScannerPreProcessor.
Class Streams Stream factory which enables the user to create streams without the knowledge of the co...
static ofString($string)
Creates a new stream with an initial value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...