Class FileUploadImplTest.
More...
◆ setUp()
ILIAS\FileUpload\FileUploadImplTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 223 of file FileUploadImplTest.php.
227 $this->prePorcessorManagerMock = \Mockery::mock(PreProcessorManager::class);
228 $this->filesystemsMock = \Mockery::mock(Filesystems::class);
229 $this->globalHttpStateMock = \Mockery::mock(GlobalHttpState::class);
231 $this->subject =
new FileUploadImpl($this->prePorcessorManagerMock, $this->filesystemsMock, $this->globalHttpStateMock);
◆ testHasUploadsWithMultipleUploadedFile()
ILIAS\FileUpload\FileUploadImplTest::testHasUploadsWithMultipleUploadedFile |
( |
| ) |
|
- Test:
Definition at line 205 of file FileUploadImplTest.php.
References $files, and $i.
208 for (
$i = 0;
$i < 10;
$i++) {
209 $files[] = Mockery::mock(UploadedFileInterface::class);
212 $this->globalHttpStateMock->shouldReceive(
'request->getUploadedFiles')
216 $this->assertTrue($this->subject->hasUploads());
◆ testHasUploadsWithoutUploadedFiles()
ILIAS\FileUpload\FileUploadImplTest::testHasUploadsWithoutUploadedFiles |
( |
| ) |
|
- Test:
Definition at line 177 of file FileUploadImplTest.php.
180 $this->globalHttpStateMock->shouldReceive(
'request->getUploadedFiles')
183 $this->assertFalse($this->subject->hasUploads());
◆ testHasUploadsWithSingleUploadedFile()
ILIAS\FileUpload\FileUploadImplTest::testHasUploadsWithSingleUploadedFile |
( |
| ) |
|
◆ testProcessWhichShouldSucceed()
ILIAS\FileUpload\FileUploadImplTest::testProcessWhichShouldSucceed |
( |
| ) |
|
Definition at line 89 of file FileUploadImplTest.php.
References $uploadedFile, ILIAS\Filesystem\Stream\Streams\ofString(), and ILIAS\FileUpload\DTO\ProcessingStatus\OK.
94 ->shouldReceive(
'getClientFilename')
96 ->andReturn(
'hello.txt')
98 ->shouldReceive(
'getSize')
102 ->shouldReceive(
'getClientMediaType')
104 ->andReturn(
'text/plain')
106 ->shouldReceive(
'getError')
108 ->andReturn(UPLOAD_ERR_OK)
110 ->shouldReceive(
'getStream')
118 $this->prePorcessorManagerMock->shouldReceive(
'process')
121 ->andReturn($processingResult);
123 $this->globalHttpStateMock->shouldReceive(
'request->getUploadedFiles')
125 ->andReturn($uploadedFiles);
127 $this->subject->process();
static ofString($string)
Creates a new stream with an initial value.
◆ testProcessWithFailedUploadWhichShouldGetRejected()
ILIAS\FileUpload\FileUploadImplTest::testProcessWithFailedUploadWhichShouldGetRejected |
( |
| ) |
|
Definition at line 134 of file FileUploadImplTest.php.
References $result, $uploadedFile, ILIAS\Filesystem\Stream\Streams\ofString(), and ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.
138 ->shouldReceive(
'getClientFilename')
140 ->andReturn(
'hello.txt')
142 ->shouldReceive(
'getSize')
146 ->shouldReceive(
'getClientMediaType')
148 ->andReturn(
'text/plain')
150 ->shouldReceive(
'getError')
152 ->andReturn(UPLOAD_ERR_PARTIAL)
154 ->shouldReceive(
'getStream')
162 $this->globalHttpStateMock->shouldReceive(
'request->getUploadedFiles')
164 ->andReturn($uploadedFiles);
166 $this->subject->process();
168 $result = $this->subject->getResults()[0];
const REJECTED
Upload got rejected by a processor.
static ofString($string)
Creates a new stream with an initial value.
◆ testRegisterWhichShouldSucceed()
ILIAS\FileUpload\FileUploadImplTest::testRegisterWhichShouldSucceed |
( |
| ) |
|
Definition at line 56 of file FileUploadImplTest.php.
58 $processorMock = \Mockery::mock(PreProcessor::class);
59 $this->prePorcessorManagerMock->shouldReceive(
'with')
61 ->with($processorMock);
63 $this->subject->register($processorMock);
◆ testRegisterWithProcessedFilesWhichShouldFail()
ILIAS\FileUpload\FileUploadImplTest::testRegisterWithProcessedFilesWhichShouldFail |
( |
| ) |
|
Definition at line 70 of file FileUploadImplTest.php.
72 $processorMock = \Mockery::mock(PreProcessor::class);
74 $this->globalHttpStateMock->shouldReceive(
'request->getUploadedFiles')
78 $this->expectException(IllegalStateException::class);
79 $this->expectExceptionMessage(
'Can not register processor after the upload was processed.');
81 $this->subject->process();
82 $this->subject->register($processorMock);
◆ $filesystemsMock
MockInterface Filesystems ILIAS\FileUpload\FileUploadImplTest::$filesystemsMock |
|
private |
◆ $globalHttpStateMock
MockInterface GlobalHttpState ILIAS\FileUpload\FileUploadImplTest::$globalHttpStateMock |
|
private |
◆ $prePorcessorManagerMock
MockInterface PreProcessorManager ILIAS\FileUpload\FileUploadImplTest::$prePorcessorManagerMock |
|
private |
◆ $subject
FileUpload ILIAS\FileUpload\FileUploadImplTest::$subject |
|
private |
The documentation for this class was generated from the following file: