1 <?php declare(strict_types=1);
17 $factory->setDatabaseAdapter($this->getMockBuilder(ilDBInterface::class)->getMock());
21 $this->assertInstanceOf(ilTermsOfServiceAcceptanceHistoryProvider::class, $provider);
22 $this->assertInstanceOf(ilTermsOfServiceTableDatabaseDataProvider::class, $provider);
23 $this->assertInstanceOf(ilTermsOfServiceTableDataProvider::class, $provider);
32 $database = $this->getMockBuilder(ilDBInterface::class)->getMock();
33 $result = $this->getMockBuilder(ilDBStatement::class)->getMock();
36 $factory->setDatabaseAdapter($database);
41 ->expects($this->exactly(2))
43 ->with($this->stringContains(
'SELECT'))
44 ->will($this->returnValue(
$result));
47 ->expects($this->exactly(4))
48 ->method(
'fetchAssoc')
49 ->will($this->onConsecutiveCalls([
'phpunit'], [
'phpunit'], [], [
'cnt' => 2]));
52 ->expects($this->any())
55 $this->isType(
'string'),
56 $this->isType(
'string'),
57 $this->isType(
'string')
58 )->will($this->returnArgument(2));
61 ->expects($this->any())
63 ->with($this->anything(), $this->isType(
'string'))
64 ->will($this->returnArgument(0));
66 $data = $provider->getList(
80 $this->assertArrayHasKey(
'items',
$data);
81 $this->assertArrayHasKey(
'cnt',
$data);
82 $this->assertCount(2,
$data[
'items']);
83 $this->assertEquals(2,
$data[
'cnt']);
93 $database = $this->getMockBuilder(ilDBInterface::class)->getMock();
96 $factory->setDatabaseAdapter($database);
101 $provider->getList(array(
'limit' =>
'phpunit'), array());
102 $this->fail(
'An expected exception has not been raised.');
107 $provider->getList(array(
'limit' => 5,
'offset' =>
'phpunit'), array());
108 $this->fail(
'An expected exception has not been raised.');
113 $provider->getList(array(
'order_field' =>
'phpunit'), array());
114 $this->fail(
'An expected exception has not been raised.');
119 $provider->getList(array(
'order_field' => 5), array());
120 $this->fail(
'An expected exception has not been raised.');
125 $provider->getList(array(
'order_field' =>
'ts',
'order_direction' =>
'phpunit'), array());
126 $this->fail(
'An expected exception has not been raised.');
const CONTEXT_ACCEPTANCE_HISTORY
testHistoryProviderCanBeCreatedByFactory()
Class ilTermsOfServiceAcceptanceHistoryProviderTest.
Class ilTermsOfServiceBaseTest.
Class ilTermsOfServiceTableDataProviderFactory.
testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed()