ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateBackgroundImageUploadTest Class Reference
+ Inheritance diagram for ilCertificateBackgroundImageUploadTest:
+ Collaboration diagram for ilCertificateBackgroundImageUploadTest:

Public Member Functions

 testFileCanBeUploaded ()
 

Detailed Description

Member Function Documentation

◆ testFileCanBeUploaded()

ilCertificateBackgroundImageUploadTest::testFileCanBeUploaded ( )

Definition at line 9 of file ilCertificateBackgroundImageUploadTest.php.

References $language, and Sabre\Event\once().

10  {
11  $fileUpload = $this->getMockBuilder('\ILIAS\FileUpload\FileUpload')
12  ->disableOriginalConstructor()
13  ->getMock();
14 
15  $fileUpload->method('hasBeenProcessed')
16  ->willReturn(false);
17 
18  $fileUpload->expects($this->once())
19  ->method('process');
20 
21  $fileUpload->method('hasUploads')
22  ->willReturn(true);
23 
24  $uploadResult = new \ILIAS\FileUpload\DTO\UploadResult(
25  'phpunit',
26  1024,
27  'text/xml',
28  $this->getMockBuilder(\ILIAS\FileUpload\Collection\ImmutableStringMap::class)->getMock(),
29  new \ILIAS\FileUpload\DTO\ProcessingStatus(\ILIAS\FileUpload\DTO\ProcessingStatus::OK, 'uploaded'),
30  '/tmp'
31  );
32 
33  $fileUpload->method('getResults')
34  ->willReturn(array("some/where/temporary" => $uploadResult));
35 
36  $fileUpload->expects($this->once())
37  ->method('moveOneFileTo');
38 
39  $language = $this->getMockBuilder('ilLanguage')
40  ->disableOriginalConstructor()
41  ->getMock();
42 
43  $logger = $this->getMockBuilder('ilLogger')
44  ->disableOriginalConstructor()
45  ->getMock();
46 
47  $fileSystem = $this->getMockBuilder('\ILIAS\Filesystem\Filesystem')
48  ->disableOriginalConstructor()
49  ->getMock();
50 
51  $fileSystem->method('hasDir')
52  ->willReturn(true);
53 
54  $fileSystem->method('has')
55  ->willReturn(true);
56 
57  $fileSystem->expects($this->once())
58  ->method('delete');
59 
60  $utilHelper = $this->getMockBuilder('ilCertificateUtilHelper')
61  ->getMock();
62 
63  $utilHelper->expects($this->exactly(2))
64  ->method('convertImage');
65 
66  $fileUtilsHelper = $this->getMockBuilder('ilCertificateFileUtilsHelper')
67  ->getMock();
68 
69  $legacyPathHelper = $this->getMockBuilder('LegacyPathHelperHelper')
70  ->getMock();
71 
72  $legacyPathHelper->method('createRelativePath')
73  ->willReturn('the/relative/path');
74 
76  $fileUpload,
77  'certifcate/path/to/some/where',
78  $language,
79  $logger,
80  $fileSystem,
81  $utilHelper,
82  $fileUtilsHelper,
83  $legacyPathHelper,
84  'Some Root Directory',
85  'someclient'
86  );
87 
88  $upload->uploadBackgroundImage('some/where/temporary', '3');
89  }
Class BaseForm.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
+ Here is the call graph for this function:

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