19declare(strict_types=1);
26use PHPUnit\Framework\TestCase;
30#[\PHPUnit\Framework\Attributes\BackupGlobals(false)]
31#[\PHPUnit\Framework\Attributes\BackupStaticProperties(false)]
32#[\PHPUnit\Framework\Attributes\PreserveGlobalState(false)]
33#[\PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses]
36 use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
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')
54 $this->assertSame(
'Virus detected.', $result->getMessage());
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')
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.