ILIAS
Release_4_4_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
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
10
class
ilTermsOfServiceTableDataProviderFactoryTest
extends
PHPUnit_Framework_TestCase
11
{
15
protected
$backupGlobals
=
false
;
16
20
public
function
setUp
()
21
{
22
}
23
27
public
function
testInstanceCanBeCreated
()
28
{
29
$factory =
new
ilTermsOfServiceTableDataProviderFactory
();
30
$this->assertInstanceOf(
'ilTermsOfServiceTableDataProviderFactory'
, $factory);
31
return
$factory;
32
}
33
39
public
function
testExceptionIsRaisedWhenUnsupportedProviderIsRequested
(
ilTermsOfServiceTableDataProviderFactory
$factory)
40
{
41
$factory->
getByContext
(
'PHP unit'
);
42
}
43
48
public
function
testFactoryShouldReturnLanguageAdapterWhenLanguageAdapterIsSet
(
ilTermsOfServiceTableDataProviderFactory
$factory)
49
{
50
$lng
= $this->getMockBuilder(
'ilLanguage'
)->disableOriginalConstructor()->getMock();
51
$factory->
setLanguageAdapter
(
$lng
);
52
$this->assertEquals(
$lng
, $factory->
getLanguageAdapter
());
53
}
54
59
public
function
testFactoryShouldReturnDatabaseAdapterWhenDatabaseAdapterIsSet
(
ilTermsOfServiceTableDataProviderFactory
$factory)
60
{
61
$db = $this->getMockBuilder(
'ilDB'
)->disableOriginalConstructor()->getMock();
62
$factory->
setDatabaseAdapter
($db);
63
$this->assertEquals($db, $factory->
getDatabaseAdapter
());
64
}
65
71
public
function
testExceptionIsRaisedWhenAgreementByLanguageProviderIsRequestedWithoutCompleteFactoryConfiguration
(
ilTermsOfServiceTableDataProviderFactory
$factory)
72
{
73
$factory->
setLanguageAdapter
(null);
74
$factory->
getByContext
(
ilTermsOfServiceTableDataProviderFactory::CONTEXT_AGRREMENT_BY_LANGUAGE
);
75
}
76
82
public
function
testExceptionIsRaisedWhenAcceptanceHistoryProviderIsRequestedWithoutCompleteFactoryConfiguration
(
ilTermsOfServiceTableDataProviderFactory
$factory)
83
{
84
$factory->
setDatabaseAdapter
(null);
85
$factory->
getByContext
(
ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY
);
86
}
87
92
public
function
testFactoryShouldReturnAgreementByLanguageProviderWhenRequested
(
ilTermsOfServiceTableDataProviderFactory
$factory)
93
{
94
$factory->
setLanguageAdapter
($this->getMockBuilder(
'ilLanguage'
)->disableOriginalConstructor()->getMock());
95
$this->assertInstanceOf(
'ilTermsOfServiceAgreementByLanguageProvider'
, $factory->
getByContext
(
ilTermsOfServiceTableDataProviderFactory::CONTEXT_AGRREMENT_BY_LANGUAGE
));
96
}
97
102
public
function
testFactoryShouldReturnAcceptanceHistoryProviderWhenRequested
(
ilTermsOfServiceTableDataProviderFactory
$factory)
103
{
104
$factory->
setDatabaseAdapter
($this->getMockBuilder(
'ilDB'
)->disableOriginalConstructor()->getMock());
105
$this->assertInstanceOf(
'ilTermsOfServiceAcceptanceHistoryProvider'
, $factory->
getByContext
(
ilTermsOfServiceTableDataProviderFactory::CONTEXT_ACCEPTANCE_HISTORY
));
106
}
107
}
Services
TermsOfService
test
factories
ilTermsOfServiceTableDataProviderFactoryTest.php
Generated on Wed Apr 27 2016 20:02:01 for ILIAS by
1.8.1.2 (using
Doxyfile
)