ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceDocumentTableDataProviderTest.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
16  {
18  $factory->setDatabaseAdapter($this->getMockBuilder(ilDBInterface::class)->getMock());
19 
21 
22  $this->assertInstanceOf(ilTermsOfServiceDocumentTableDataProvider::class, $provider);
23  $this->assertInstanceOf(ilTermsOfServiceTableDataProvider::class, $provider);
24 
25  return $provider;
26  }
27 
34  {
35  $documentConnector = $this->getMockBuilder(arConnector::class)->getMock();
36  $criterionConnector = $this->getMockBuilder(arConnector::class)->getMock();
37 
38  $documentData = [
39  [
40  'id' => 1,
41  ],
42  [
43  'id' => 2,
44  ],
45  [
46  'id' => 3,
47  ]
48  ];
49 
50  $documentConnector
51  ->expects($this->once())
52  ->method('readSet')
53  ->willReturn($documentData);
54 
55  $criterionConnector
56  ->expects($this->exactly(count($documentData)))
57  ->method('readSet')
58  ->willReturnCallback(function () {
59  return [];
60  });
61 
62  arConnectorMap::register(new ilTermsOfServiceDocument(), $documentConnector);
64 
65  $data = $provider->getList([], []);
66 
67  $this->assertArrayHasKey('items', $data);
68  $this->assertArrayHasKey('cnt', $data);
69  $this->assertCount(3, $data['items']);
70  $this->assertEquals(3, $data['cnt']);
71  }
72 }
$data
Definition: storeScorm.php:23
static register(ActiveRecord $ar, arConnector $connector)
testListOfDocumentsCanBeRetrieved(ilTermsOfServiceDocumentTableDataProvider $provider)
testDocumentProviderCanBeCreatedByFactory
Class ilTermsOfServiceDocumentTableDataProviderTest.
Class ilTermsOfServiceBaseTest.
getList(array $params, array $filter)
Table parameters like limit or order Filter settings provided by a ilTable2GUI instance array An asso...
Class ilTermsOfServiceDocument.
$factory
Definition: metadata.php:58