ILIAS
release_10 Revision v10.1-43-ga1241a92c2f
◀ ilDoc Overview
PreProcessorTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\LegalDocuments\test\FileUpload
;
22
23
use
ILIAS\FileUpload\DTO\ProcessingStatus
;
24
use
ILIAS\LegalDocuments\test\ContainerMock
;
25
use
ILIAS\FileUpload\DTO\Metadata
;
26
use
ILIAS\Filesystem\Stream\FileStream
;
27
use
PHPUnit\Framework\TestCase
;
28
use
ILIAS\LegalDocuments\FileUpload\PreProcessor
;
29
30
require_once __DIR__ .
'/../ContainerMock.php'
;
31
32
class
PreProcessorTest
extends
TestCase
33
{
34
use
ContainerMock
;
35
36
public
function
testConstruct
(): void
37
{
38
$this->assertInstanceOf(PreProcessor::class,
new
PreProcessor
($this->fail(...)));
39
}
40
41
public
function
testProcess
(): void
42
{
43
$expected_value =
'Dummty content'
;
44
$value = null;
45
$instance =
new
PreProcessor
(
static
function
(
string
$content) use (&$value):
void
{
46
$value = $content;
47
});
48
49
$result = $instance->
process
(
50
$this->mockMethod(FileStream::class,
'getContents'
, [], $expected_value),
51
new
Metadata
(
'dummy file name'
, 1234,
'text/html'
)
// Cannot be mocked because it is final.
52
);
53
54
$this->assertSame($expected_value, $value);
55
$this->assertInstanceOf(ProcessingStatus::class, $result);
56
$this->assertSame(
ProcessingStatus::OK
, $result->getCode());
57
$this->assertSame(
'idontcare'
, $result->getMessage());
58
}
59
}
ContainerMock
ILIAS\LegalDocuments\FileUpload\PreProcessor
Definition:
PreProcessor.php:29
PreProcessor
ILIAS\LegalDocuments\test\FileUpload
Definition:
PreProcessorTest.php:21
ILIAS\LegalDocuments\FileUpload\PreProcessor\process
process(FileStream $stream, Metadata $metadata)
Definition:
PreProcessor.php:38
ILIAS\LegalDocuments\test\FileUpload\PreProcessorTest\testConstruct
testConstruct()
Definition:
PreProcessorTest.php:36
ProcessingStatus
ContainerMock
ILIAS\FileUpload\DTO\Metadata
ILIAS\LegalDocuments\test\FileUpload\PreProcessorTest
Definition:
PreProcessorTest.php:32
FileStream
ServicesInterface
ILIAS\LegalDocuments\test\FileUpload\PreProcessorTest\testProcess
testProcess()
Definition:
PreProcessorTest.php:41
TestCase
ILIAS\FileUpload\DTO\ProcessingStatus\OK
const OK
Upload is ok.
Definition:
ProcessingStatus.php:41
components
ILIAS
LegalDocuments
tests
FileUpload
PreProcessorTest.php
Generated on Wed Sep 10 2025 15:15:53 for ILIAS by
1.8.13 (using
Doxyfile
)