ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateTemplateExportActionTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
9 public function testExport()
10 {
11 $templateRepository = $this->getMockBuilder('ilCertificateTemplateRepository')
12 ->disableOriginalConstructor()
13 ->getMock();
14
15 $templateRepository->method('fetchCurrentlyActiveCertificate')
16 ->willReturn(new ilCertificateTemplate(
17 100,
18 'crs',
19 '<xml> Some Content </xml>',
20 md5('<xml> Some Content </xml>'),
21 '[]',
22 '3',
23 'v5.4.0',
24 123456789,
25 true,
26 '/some/where/background.jpg',
27 50
28 ));
29
30 $filesystem = $this->getMockBuilder('ILIAS\Filesystem\Filesystem')
31 ->getMock();
32
33 $filesystem
34 ->expects($this->once())
35 ->method('createDir');
36
37 $filesystem
38 ->expects($this->once())
39 ->method('put');
40
41 $filesystem
42 ->expects($this->once())
43 ->method('deleteDir');
44
45 $filesystem
46 ->expects($this->once())
47 ->method('put');
48
49 $objectHelper = $this->getMockBuilder('ilCertificateObjectHelper')
50 ->getMock();
51
52 $objectHelper->method('lookupType')
53 ->willReturn('crs');
54
55 $utilHelper = $this->getMockBuilder('ilCertificateUtilHelper')
56 ->getMock();
57
58 $utilHelper
59 ->expects($this->once())
60 ->method('zip');
61
62 $utilHelper
63 ->expects($this->once())
64 ->method('deliverFile');
65
67 100,
68 '/some/where/background.jpg',
69 $templateRepository,
70 $filesystem,
71 $objectHelper,
72 $utilHelper
73 );
74
75 $action->export('some/where/root', 'phpunit');
76 }
77}
An exception for terminatinating execution or to throw for unit testing.
$action
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.