ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DocumentTableTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ilCtrl;
39 use ilObjUser;
45 
46 require_once __DIR__ . '/../ContainerMock.php';
47 
48 class DocumentTableTest extends TestCase
49 {
50  use ContainerMock;
51 
52  public function testConstruct(): void
53  {
54  $uri = $this->mock(UriInterface::class);
55  $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50');
56 
57  $request = $this->mock(ServerRequestInterface::class);
58  $request->method("getUri")->willReturn($uri);
59 
60  $this->assertInstanceOf(DocumentTable::class, new DocumentTable(
61  $this->fail(...),
62  $this->mock(DocumentRepository::class),
63  $this->mock(UI::class),
64  $this->mock(DocumentModal::class),
65  $this->mock(ilLegalDocumentsAdministrationGUI::class),
66  null,
67  $request,
68  new Factory(),
69  $this->mock(ilCtrl::class),
70  $this->mock(Renderer::class),
71  $this->mockTree(ilObjUser::class, ['getTimeZone' => 'europe/berlin'])
72  ));
73  }
74 
75  public function testCriterionName(): void
76  {
77  $uri = $this->mock(UriInterface::class);
78  $uri->method('__toString')->willReturn('http://myIlias/ilias.php?baseClass=iladministrationgui&cmdNode=2g:qo:gq&cmdClass=ilLegalDocumentsAdministrationGUI&cmd=documents&ref_id=50');
79 
80  $request = $this->mock(ServerRequestInterface::class);
81  $request->method("getUri")->willReturn($uri);
82 
83  $content = $this->mock(CriterionContent::class);
84  $component = $this->mock(Component::class);
85 
86  $instance = new DocumentTable(
87  function (CriterionContent $c) use ($content, $component) {
88  $this->assertSame($content, $c);
89  return $component;
90  },
91  $this->mock(DocumentRepository::class),
92  $this->mock(UI::class),
93  $this->mock(DocumentModal::class),
94  $this->mock(ilLegalDocumentsAdministrationGUI::class),
95  null,
96  $request,
97  new Factory(),
98  $this->mock(ilCtrl::class),
99  $this->mock(Renderer::class),
100  $this->mockTree(ilObjUser::class, ['getTimeZone' => 'europe/berlin'])
101  );
102 
103  $this->assertSame(
104  $component,
105  $instance->criterionName($this->mockTree(Criterion::class, ['content' => $content]))
106  );
107  }
108 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: deliver.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Builds data types.
Definition: Factory.php:35