15        $factory = new \ilTermsOfServiceTableDataProviderFactory();
 
   16        $factory->setDatabaseAdapter($this->getMockBuilder(\ilDBInterface::class)->getMock());
 
   20        $this->assertInstanceOf(\ilTermsOfServiceAcceptanceHistoryProvider::class, 
$provider);
 
   21        $this->assertInstanceOf(\ilTermsOfServiceTableDatabaseDataProvider::class, 
$provider);
 
   22        $this->assertInstanceOf(\ilTermsOfServiceTableDataProvider::class, 
$provider);
 
   30        $database = $this->getMockBuilder(\ilDBInterface::class)->getMock();
 
   31        $result = $this->getMockBuilder(\ilDBStatement::class)->getMock();
 
   33        $factory = new \ilTermsOfServiceTableDataProviderFactory();
 
   34        $factory->setDatabaseAdapter($database);
 
   39            ->expects($this->exactly(2))
 
   41            ->with($this->stringContains(
'SELECT'))
 
   42            ->will($this->returnValue(
$result));
 
   45            ->expects($this->exactly(4))
 
   46            ->method(
'fetchAssoc')
 
   47            ->will($this->onConsecutiveCalls([
'phpunit'], [
'phpunit'], [], [
'cnt' => 2]));
 
   50            ->expects($this->any())
 
   53                $this->isType(
'string'),
 
   54                $this->isType(
'string'),
 
   55                $this->isType(
'string')
 
   56            )->will($this->returnArgument(2));
 
   59            ->expects($this->any())
 
   61            ->with($this->anything(), $this->isType(
'string'))
 
   62            ->will($this->returnArgument(0));
 
   78        $this->assertArrayHasKey(
'items', 
$data);
 
   79        $this->assertArrayHasKey(
'cnt', 
$data);
 
   80        $this->assertCount(2, 
$data[
'items']);
 
   81        $this->assertEquals(2, 
$data[
'cnt']);
 
   89        $database = $this->getMockBuilder(\ilDBInterface::class)->getMock();
 
   91        $factory = new \ilTermsOfServiceTableDataProviderFactory();
 
   92        $factory->setDatabaseAdapter($database);
 
   97            $provider->getList(array(
'limit' => 
'phpunit'), array());
 
   98            $this->fail(
'An expected exception has not been raised.');
 
   99        } 
catch (\InvalidArgumentException $e) {
 
  103            $provider->getList(array(
'limit' => 5, 
'offset' => 
'phpunit'), array());
 
  104            $this->fail(
'An expected exception has not been raised.');
 
  105        } 
catch (\InvalidArgumentException $e) {
 
  109            $provider->getList(array(
'order_field' => 
'phpunit'), array());
 
  110            $this->fail(
'An expected exception has not been raised.');
 
  111        } 
catch (\InvalidArgumentException $e) {
 
  115            $provider->getList(array(
'order_field' => 5), array());
 
  116            $this->fail(
'An expected exception has not been raised.');
 
  117        } 
catch (\InvalidArgumentException $e) {
 
  121            $provider->getList(array(
'order_field' => 
'ts', 
'order_direction' => 
'phpunit'), array());
 
  122            $this->fail(
'An expected exception has not been raised.');
 
  123        } 
catch (\InvalidArgumentException $e) {
 
An exception for terminatinating execution or to throw for unit testing.
Class ilTermsOfServiceAcceptanceHistoryProviderTest.
testRetrievingListThrowsExceptionsWhenInvalidArgumentsArePassed()
testHistoryProviderCanBeCreatedByFactory()
Class ilTermsOfServiceBaseTest.
const CONTEXT_ACCEPTANCE_HISTORY