ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilKioskModeServiceTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 require_once "class.ilDummyKioskModeView.php";
24 
26 {
27  public function test_createObject(): void
28  {
29  $ctrl = $this->createMock(ilCtrl::class);
30  $lng = $this->createMock(ilLanguage::class);
31  $access = $this->createMock(ilAccess::class);
32  $obj_definition = $this->createMock(ilObjectDefinition::class);
33 
34  $obj = new ilKioskModeService($ctrl, $lng, $access, $obj_definition);
35 
36  $this->assertInstanceOf(ilKioskModeService::class, $obj);
37  }
38 
39  public function test_getViewFor_non_existing_type(): void
40  {
41  $ctrl = $this->createMock(ilCtrl::class);
42  $lng = $this->createMock(ilLanguage::class);
43  $access = $this->createMock(ilAccess::class);
44 
45  $ilObject = $this->createMock(ilObject::class);
46  $ilObject
47  ->expects($this->once())
48  ->method("getType")
49  ->willReturn("testtype")
50  ;
51 
52  $obj_definition = $this->createMock(ilObjectDefinition::class);
53  $obj_definition
54  ->expects($this->exactly(1))
55  ->method("getClassName")
56  ->with("testtype")
57  ->willReturn("wrong")
58  ;
59 
60 
61  $obj = new ilKioskModeService($ctrl, $lng, $access, $obj_definition);
62  $this->assertNull($obj->getViewFor($ilObject));
63  }
64 
65  public function test_getViewFor(): void
66  {
67  $ctrl = $this->createMock(ilCtrl::class);
68  $lng = $this->createMock(ilLanguage::class);
69  $access = $this->createMock(ilAccess::class);
70 
71  $ilObject = $this->createMock(ilObject::class);
72  $ilObject
73  ->expects($this->once())
74  ->method("getType")
75  ->willReturn("testtype")
76  ;
77 
78  $obj_definition = $this->createMock(ilObjectDefinition::class);
79  $obj_definition
80  ->expects($this->exactly(2))
81  ->method("getClassName")
82  ->with("testtype")
83  ->willReturn("Dummy")
84  ;
85 
86 
87  $obj = new ilKioskModeService($ctrl, $lng, $access, $obj_definition);
88  $result = $obj->getViewFor($ilObject);
89 
90  $this->assertInstanceOf(ilDummyKioskModeView::class, $result);
91  }
92 }
Central entry point for users of the service.
global $lng
Definition: privfeed.php:31