ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTermsOfServiceAcceptanceHistoryProviderTest Class Reference
+ Inheritance diagram for ilTermsOfServiceAcceptanceHistoryProviderTest:
+ Collaboration diagram for ilTermsOfServiceAcceptanceHistoryProviderTest:

Public Member Functions

 setUp ()
 
 testHistoryProviderCanBeCreatedByFactory ()
 
 testListCanBeRetrieved ()
 
 testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed ()
 

Protected Attributes

 $backupGlobals = false
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 assertException ($exception_class)
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 12 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

Member Function Documentation

◆ setUp()

ilTermsOfServiceAcceptanceHistoryProviderTest::setUp ( )

Definition at line 22 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

23  {
24  }

◆ testHistoryProviderCanBeCreatedByFactory()

ilTermsOfServiceAcceptanceHistoryProviderTest::testHistoryProviderCanBeCreatedByFactory ( )
Returns
ilTermsOfServiceAcceptanceHistoryProvider

Definition at line 29 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References League\OAuth2\Client\Provider\$provider, and ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY.

30  {
32  $factory->setDatabaseAdapter($this->getMockBuilder('ilDBInterface')->getMock());
34 
35  $this->assertInstanceOf('ilTermsOfServiceAcceptanceHistoryProvider', $provider);
36  $this->assertInstanceOf('ilTermsOfServiceTableDatabaseDataProvider', $provider);
37  $this->assertInstanceOf('ilTermsOfServiceTableDataProvider', $provider);
38 
39  return $provider;
40  }

◆ testListCanBeRetrieved()

ilTermsOfServiceAcceptanceHistoryProviderTest::testListCanBeRetrieved ( )

Definition at line 45 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References $data, League\OAuth2\Client\Provider\$provider, $result, array, ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY, and time.

46  {
47  $database = $this->getMockBuilder('ilDBInterface')->getMock();
48  $result = $this->getMockBuilder('ilDBStatement')->getMock();
49 
51  $factory->setDatabaseAdapter($database);
53 
54  $database->expects($this->exactly(2))->method('query')->with($this->stringContains('SELECT'))->will($this->returnValue($result));
55  $database->expects($this->exactly(4))->method('fetchAssoc')->will($this->onConsecutiveCalls(array('phpunit'), array('phpunit'), array(), array('cnt' => 2)));
56  $database->expects($this->any())->method('like')->with(
57  $this->isType('string'),
58  $this->isType('string'),
59  $this->isType('string')
60  )->will($this->returnArgument(2));
61  $database->expects($this->any())->method('quote')->with($this->anything(), $this->isType('string'))->will($this->returnArgument(0));
62 
63  $data = $provider->getList(
64  array(
65  'limit' => 5,
66  'order_field' => 'ts'
67  ),
68  array(
69  'query' => 'phpunit',
70  'lng' => 'en',
71  'period' => array(
72  'start' => time(),
73  'end' => time()
74  )
75  )
76  );
77  $this->assertArrayHasKey('items', $data);
78  $this->assertArrayHasKey('cnt', $data);
79  $this->assertCount(2, $data['items']);
80  $this->assertEquals(2, $data['cnt']);
81  }
$result
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed()

ilTermsOfServiceAcceptanceHistoryProviderTest::testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed ( )

Definition at line 86 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References League\OAuth2\Client\Provider\$provider, array, and ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY.

87  {
88  $database = $this->getMockBuilder('ilDBInterface')->getMock();
90  $factory->setDatabaseAdapter($database);
92 
93  try
94  {
95  $provider->getList(array('limit' => 'phpunit'), array());
96  $this->fail('An expected exception has not been raised.');
97  }
98  catch(InvalidArgumentException $e)
99  {
100  }
101 
102  try
103  {
104  $provider->getList(array('limit' => 5, 'offset' => 'phpunit'), array());
105  $this->fail('An expected exception has not been raised.');
106  }
107  catch(InvalidArgumentException $e)
108  {
109  }
110 
111  try
112  {
113  $provider->getList(array('order_field' => 'phpunit'), array());
114  $this->fail('An expected exception has not been raised.');
115  }
116  catch(InvalidArgumentException $e)
117  {
118  }
119 
120  try
121  {
122  $provider->getList(array('order_field' => 5), array());
123  $this->fail('An expected exception has not been raised.');
124  }
125  catch(InvalidArgumentException $e)
126  {
127  }
128 
129  try
130  {
131  $provider->getList(array('order_field' => 'ts', 'order_direction' => 'phpunit'), array());
132  $this->fail('An expected exception has not been raised.');
133  }
134  catch(InvalidArgumentException $e)
135  {
136  }
137  }
Create styles array
The data for the language used.

Field Documentation

◆ $backupGlobals

ilTermsOfServiceAcceptanceHistoryProviderTest::$backupGlobals = false
protected

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