ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest:

Public Member Functions

 testConstruct ()
 
 testGetFileIdentifierParameterName ()
 
 testLinks ()
 
 testInfoResultWithResult ()
 
 testInfoResultWithoutResult ()
 

Detailed Description

Definition at line 33 of file UploadHandlerTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest::testConstruct ( )

Definition at line 37 of file UploadHandlerTest.php.

37  : void
38  {
39  $this->assertInstanceOf(UploadHandler::class, new UploadHandler($this->fail(...), $this->fail(...), $this->fail(...)));
40  }

◆ testGetFileIdentifierParameterName()

ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest::testGetFileIdentifierParameterName ( )

Definition at line 42 of file UploadHandlerTest.php.

42  : void
43  {
44  $instance = new UploadHandler($this->fail(...), $this->fail(...), $this->fail(...));
45  $this->assertSame(UploadHandlerInterface::DEFAULT_FILE_ID_PARAMETER, $instance->getFileIdentifierParameterName());
46  }

◆ testInfoResultWithoutResult()

ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest::testInfoResultWithoutResult ( )

Definition at line 81 of file UploadHandlerTest.php.

References null.

81  : void
82  {
83  $content = fn() => new Error('Nothing uploaded yet.');
84 
85  $instance = new UploadHandler($this->fail(...), $content, $this->fail(...));
86  $this->assertSame(null, $instance->getInfoResult('foo'));
87  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testInfoResultWithResult()

ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest::testInfoResultWithResult ( )

Definition at line 65 of file UploadHandlerTest.php.

65  : void
66  {
67  $value = 'Lorem ipsum';
68  $document_content = $this->mockTree(DocumentContent::class, [
69  'value' => $value,
70  'type' => 'html',
71  ]);
72  $content = fn() => new Ok($document_content);
73  $instance = new UploadHandler($this->fail(...), $content, fn(string $s) => 'Translated ' . $s);
74  $info = $instance->getInfoResult('foo');
75  $this->assertSame(strlen($value), $info->getSize());
76  $this->assertSame('html', $info->getMimeType());
77  $this->assertSame('Translated updated_document', $info->getName());
78  $this->assertSame('foo', $info->getFileIdentifier());
79  }

◆ testLinks()

ILIAS\LegalDocuments\test\FileUpload\UploadHandlerTest::testLinks ( )

Definition at line 48 of file UploadHandlerTest.php.

48  : void
49  {
50  $instance = new UploadHandler(
51  static fn(string $to): string => 'Will link to: ' . $to,
52  $this->fail(...),
53  $this->fail(...)
54  );
55  $this->assertGetter($instance, [
56  'getUploadURL' => 'Will link to: upload',
57  'getFileRemovalURL' => 'Will link to: rm',
58  'getExistingFileInfoURL' => 'Will link to: info',
59  'supportsChunkedUploads' => false,
60  ]);
61  $this->assertSame([], $instance->getInfoForExistingFiles([]));
62  $this->assertSame([], $instance->getInfoForExistingFiles(['foo']));
63  }

The documentation for this class was generated from the following file: