ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceDocumentTableDataProviderTest Class Reference

Class ilTermsOfServiceDocumentTableDataProviderTest. More...

+ Inheritance diagram for ilTermsOfServiceDocumentTableDataProviderTest:
+ Collaboration diagram for ilTermsOfServiceDocumentTableDataProviderTest:

Public Member Functions

 testDocumentProviderCanBeCreatedByFactory ()
 
 testListOfDocumentsCanBeRetrieved (\ilTermsOfServiceDocumentTableDataProvider $provider)
 testDocumentProviderCanBeCreatedByFactory More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 setGlobalVariable (string $name, $value)
 
 assertException (string $exceptionClass)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ testDocumentProviderCanBeCreatedByFactory()

ilTermsOfServiceDocumentTableDataProviderTest::testDocumentProviderCanBeCreatedByFactory ( )
Returns
Exceptions

Definition at line 14 of file ilTermsOfServiceDocumentTableDataProviderTest.php.

References $factory, PHPMailer\PHPMailer\$provider, and ilTermsOfServiceTableDataProviderFactory\CONTEXT_DOCUMENTS.

15  {
16  $factory = new \ilTermsOfServiceTableDataProviderFactory();
17  $factory->setDatabaseAdapter($this->getMockBuilder(\ilDBInterface::class)->getMock());
18 
20 
21  $this->assertInstanceOf(\ilTermsOfServiceDocumentTableDataProvider::class, $provider);
22  $this->assertInstanceOf(\ilTermsOfServiceTableDataProvider::class, $provider);
23 
24  return $provider;
25  }
$factory
Definition: metadata.php:43

◆ testListOfDocumentsCanBeRetrieved()

ilTermsOfServiceDocumentTableDataProviderTest::testListOfDocumentsCanBeRetrieved ( \ilTermsOfServiceDocumentTableDataProvider  $provider)

testDocumentProviderCanBeCreatedByFactory

Parameters
ilTermsOfServiceDocumentTableDataProvider$provider

Definition at line 31 of file ilTermsOfServiceDocumentTableDataProviderTest.php.

References $data, ilTermsOfServiceDocumentTableDataProvider\getList(), Sabre\Event\once(), and arConnectorMap\register().

32  {
33  $documentConnector = $this->getMockBuilder(\arConnector::class)->getMock();
34  $criterionConnector = $this->getMockBuilder(\arConnector::class)->getMock();
35 
36  $documentData = [
37  [
38  'id' => 1,
39  ],
40  [
41  'id' => 2,
42  ],
43  [
44  'id' => 3,
45  ]
46  ];
47 
48  $documentConnector
49  ->expects($this->once())
50  ->method('readSet')
51  ->willReturn($documentData);
52 
53  $criterionConnector
54  ->expects($this->exactly(count($documentData)))
55  ->method('readSet')
56  ->willReturnCallback(function () {
57  return [];
58  });
59 
60  \arConnectorMap::register(new \ilTermsOfServiceDocument(), $documentConnector);
62 
63  $data = $provider->getList([], []);
64 
65  $this->assertArrayHasKey('items', $data);
66  $this->assertArrayHasKey('cnt', $data);
67  $this->assertCount(3, $data['items']);
68  $this->assertEquals(3, $data['cnt']);
69  }
static register(ActiveRecord $ar, arConnector $connector)
Class ilTermsOfServiceDocument.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
$data
Definition: bench.php:6
+ Here is the call graph for this function:

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