ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTermsOfServiceAcceptanceHistoryProviderTest Class Reference
+ Inheritance diagram for ilTermsOfServiceAcceptanceHistoryProviderTest:
+ Collaboration diagram for ilTermsOfServiceAcceptanceHistoryProviderTest:

Public Member Functions

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

Protected Attributes

 $backupGlobals = false

Detailed Description

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

Definition at line 11 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

Member Function Documentation

ilTermsOfServiceAcceptanceHistoryProviderTest::setUp ( )

Definition at line 21 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

{
}
ilTermsOfServiceAcceptanceHistoryProviderTest::testHistoryProviderCanBeCreatedByFactory ( )
Returns
ilTermsOfServiceAcceptanceHistoryProvider

Definition at line 28 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY.

{
$factory->setDatabaseAdapter($this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock());
$this->assertInstanceOf('ilTermsOfServiceAcceptanceHistoryProvider', $provider);
$this->assertInstanceOf('ilTermsOfServiceTableDatabaseDataProvider', $provider);
$this->assertInstanceOf('ilTermsOfServiceTableDataProvider', $provider);
return $provider;
}
ilTermsOfServiceAcceptanceHistoryProviderTest::testListCanBeRetrieved ( )

Definition at line 44 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References $result, and ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY.

{
$database = $this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock();
$result = $this->getMockBuilder('MDB2_BufferedResult_mysqli')->disableOriginalConstructor()->getMock();
$factory->setDatabaseAdapter($database);
$database->expects($this->exactly(2))->method('query')->with($this->stringContains('SELECT'))->will($this->returnValue($result));
$database->expects($this->exactly(4))->method('fetchAssoc')->will($this->onConsecutiveCalls(array('phpunit'), array('phpunit'), array(), array('cnt' => 2)));
$database->expects($this->any())->method('like')->with(
$this->isType('string'),
$this->isType('string'),
$this->isType('string')
)->will($this->returnArgument(2));
$database->expects($this->any())->method('quote')->with($this->anything(), $this->isType('string'))->will($this->returnArgument(0));
$data = $provider->getList(
array(
'limit' => 5,
'order_field' => 'ts'
),
array(
'query' => 'phpunit',
'lng' => 'en',
'period' => array(
'start' => time(),
'end' => time()
)
)
);
$this->assertArrayHasKey('items', $data);
$this->assertArrayHasKey('cnt', $data);
$this->assertCount(2, $data['items']);
$this->assertEquals(2, $data['cnt']);
}
ilTermsOfServiceAcceptanceHistoryProviderTest::testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed ( )

Definition at line 85 of file ilTermsOfServiceAcceptanceHistoryProviderTest.php.

References ilTermsOfServiceTableDataProviderFactory\CONTEXT_ACCEPTANCE_HISTORY.

{
$database = $this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock();
$factory->setDatabaseAdapter($database);
try
{
$provider->getList(array('limit' => 'phpunit'), array());
$this->fail('An expected exception has not been raised.');
}
catch(InvalidArgumentException $e)
{
}
try
{
$provider->getList(array('limit' => 5, 'offset' => 'phpunit'), array());
$this->fail('An expected exception has not been raised.');
}
catch(InvalidArgumentException $e)
{
}
try
{
$provider->getList(array('order_field' => 'phpunit'), array());
$this->fail('An expected exception has not been raised.');
}
catch(InvalidArgumentException $e)
{
}
try
{
$provider->getList(array('order_field' => 5), array());
$this->fail('An expected exception has not been raised.');
}
catch(InvalidArgumentException $e)
{
}
try
{
$provider->getList(array('order_field' => 'ts', 'order_direction' => 'phpunit'), array());
$this->fail('An expected exception has not been raised.');
}
catch(InvalidArgumentException $e)
{
}
}

Field Documentation

ilTermsOfServiceAcceptanceHistoryProviderTest::$backupGlobals = false
protected

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