Class PreProcessorManagerImplTest.
More...
◆ setUp()
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::setUp |
( |
| ) |
|
|
protected |
◆ testProcessInvalidFileWhichShouldGetRejected()
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::testProcessInvalidFileWhichShouldGetRejected |
( |
| ) |
|
Definition at line 111 of file PreProcessorManagerImplTestTBD.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\OK, and ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.
116 $metadata =
new Metadata(
'test.txt', 4500,
'text/plain');
118 $processor = Mockery::mock(PreProcessor::class);
119 $processor->shouldReceive(
'process')
122 ->andReturnValues([$responseGood, $responseBad, $responseGood]);
124 $stream = Mockery::mock(FileStream::class);
125 $stream->shouldReceive(
'rewind')
129 $this->subject->with($processor);
130 $this->subject->with($processor);
131 $this->subject->with($processor);
133 $result = $this->subject->process($stream, $metadata);
135 $this->assertSame($responseBad->getCode(), $result->getCode());
136 $this->assertSame($responseBad->getMessage(), $result->getMessage());
◆ testProcessValidFileWhichShouldSucceed()
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::testProcessValidFileWhichShouldSucceed |
( |
| ) |
|
Definition at line 68 of file PreProcessorManagerImplTestTBD.php.
References $response, and ILIAS\FileUpload\DTO\ProcessingStatus\OK.
71 $metadata =
new Metadata(
'test.txt', 4500,
'text/plain');
73 $processor = Mockery::mock(PreProcessor::class);
74 $processor->shouldReceive(
'process')
79 $stream = Mockery::mock(FileStream::class);
80 $stream->shouldReceive(
'rewind')
84 $this->subject->with($processor);
85 $this->subject->with($processor);
86 $this->subject->with($processor);
88 $result = $this->subject->process($stream, $metadata);
91 $this->assertSame(
'All green!', $result->getMessage());
◆ testProcessValidFileWithFailingProcessorWhichShouldGetRejected()
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::testProcessValidFileWithFailingProcessorWhichShouldGetRejected |
( |
| ) |
|
Definition at line 141 of file PreProcessorManagerImplTestTBD.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\OK, and ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.
145 $metadata =
new Metadata(
'test.txt', 4500,
'text/plain');
147 $processor = Mockery::mock(PreProcessor::class);
148 $processor->shouldReceive(
'process')
151 ->andReturn($responseGood);
153 $processor->shouldReceive(
'process')
156 ->andThrow(\RuntimeException::class,
'Bad stuff happened!');
158 $stream = Mockery::mock(FileStream::class);
159 $stream->shouldReceive(
'rewind')
163 $this->subject->with($processor);
164 $this->subject->with($processor);
165 $this->subject->with($processor);
167 $result = $this->subject->process($stream, $metadata);
170 $this->assertSame(
'Processor failed with exception message "Bad stuff happened!"', $result->getMessage());
◆ testProcessWithoutProcessorsWhichShouldSucceed()
ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::testProcessWithoutProcessorsWhichShouldSucceed |
( |
| ) |
|
Definition at line 96 of file PreProcessorManagerImplTestTBD.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\OK.
98 $expectedResponse =
new ProcessingStatus(
ProcessingStatus::OK,
'No processors were registered.');
99 $metadata =
new Metadata(
'test.txt', 4500,
'text/plain');
101 $stream = Mockery::mock(FileStream::class);
103 $result = $this->subject->process($stream, $metadata);
105 $this->assertSame($expectedResponse->getCode(), $result->getCode());
106 $this->assertSame($expectedResponse->getMessage(), $result->getMessage());
◆ $subject
PreProcessorManager ILIAS\MetaData\Repository\Validation\Processor\PreProcessorManagerImplTest::$subject |
|
private |
The documentation for this class was generated from the following file: