ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTermsOfServiceTableDataProviderFactoryTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceTableDataProviderFactory.php';
5 
11 {
15  protected $backupGlobals = false;
16 
20  public function setUp()
21  {
22  }
23 
27  public function testInstanceCanBeCreated()
28  {
30  $this->assertInstanceOf('ilTermsOfServiceTableDataProviderFactory', $factory);
31  return $factory;
32  }
33 
40  {
41  $factory->getByContext('PHP unit');
42  }
43 
49  {
50  $lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock();
51  $factory->setLanguageAdapter($lng);
52  $this->assertEquals($lng, $factory->getLanguageAdapter());
53  }
54 
60  {
61  $db = $this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock();
62  $factory->setDatabaseAdapter($db);
63  $this->assertEquals($db, $factory->getDatabaseAdapter());
64  }
65 
72  {
73  $factory->setLanguageAdapter(null);
75  }
76 
83  {
84  $factory->setDatabaseAdapter(null);
86  }
87 
93  {
94  $factory->setLanguageAdapter($this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock());
95  $this->assertInstanceOf('ilTermsOfServiceAgreementByLanguageProvider', $factory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_AGRREMENT_BY_LANGUAGE));
96  }
97 
103  {
104  $factory->setDatabaseAdapter($this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock());
105  $this->assertInstanceOf('ilTermsOfServiceAcceptanceHistoryProvider', $factory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY));
106  }
107 }