16 if (
defined(
'ILIAS_PHPUNIT_CONTEXT')) {
17 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
18 ilUnitUtil::performInitialisation();
20 chdir(dirname(__FILE__));
24 require_once
'./Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
30 $this->assertInstanceOf(
'ilChatroomServerSettings', $this->
settings);
36 array(
'port',
'integer', 7373),
37 array(
'protocol',
'string',
'http://'),
38 array(
'domain',
'string',
'127.0.0.1'),
40 array(
'authKey',
'string',
'cfdf79fc-4133-4f3b-882f-5162a87dc465'),
41 array(
'authSecret',
'string',
'f8072a49-0488-411f-be0a-723a762700ba'),
42 array(
'clientUrlEnabled',
'boolean',
true),
43 array(
'clientUrl',
'string',
'http://proxy.localhost'),
44 array(
'iliasUrlEnabled',
'boolean',
true),
45 array(
'iliasUrl',
'string',
'http://proxy.localhost'),
46 array(
'smiliesEnabled',
'boolean',
false),
49 array(
'instance',
'string',
'123456'),
61 $setter =
'set' . ucfirst($property);
62 $getter =
'get' . ucfirst(($property));
64 $this->assertTrue(method_exists($this->
settings, $setter), sprintf(
'The Setter "%s" does not exist', $setter));
65 $this->assertTrue(method_exists($this->
settings, $getter), sprintf(
'The Getter "%s" does not exist', $setter));
68 $actual = $this->
settings->$getter();
70 $this->assertEquals($value, $actual, sprintf(
'The expected value "%s" is not equals to "%s"', $value, $actual));
72 if (class_exists(
$type)) {
73 $this->assertInstanceOf(
76 sprintf(
'The actual return value is not an instance of "%s"',
$type)
79 $this->assertInternalType(
$type, $actual, sprintf(
'The actual return value is not a type of "%s"',
$type));
94 $this->assertEquals($expected, $this->
settings->getBaseURL());
101 $clientDomain =
'proxy.localhost';
103 $expected = sprintf(
'%s%s:%s',
$protocol, $clientDomain, $port);
105 $this->
settings->setClientUrlEnabled(
true);
109 $this->
settings->setClientUrl(sprintf(
'%s:%s', $clientDomain, $port));
111 $this->assertEquals($expected, $this->
settings->generateClientUrl());
118 $clientDomain =
'proxy.localhost';
122 $this->
settings->setClientUrlEnabled(
false);
126 $this->
settings->setClientUrl(sprintf(
'%s:%s', $clientDomain, $port));
128 $this->assertEquals($expected, $this->
settings->generateClientUrl());
135 $iliasDomain =
'proxy.localhost';
137 $expected = sprintf(
'%s%s:%s',
$protocol, $iliasDomain, $port);
139 $this->
settings->setIliasUrlEnabled(
true);
143 $this->
settings->setIliasUrl(sprintf(
'%s:%s', $iliasDomain, $port));
145 $this->assertEquals($expected, $this->
settings->generateIliasUrl());
152 $iliasDomain =
'proxy.localhost';
156 $this->
settings->setIliasUrlEnabled(
false);
160 $this->
settings->setIliasUrl(sprintf(
'%s:%s', $iliasDomain, $port));
162 $this->assertEquals($expected, $this->
settings->generateIliasUrl());
169 $iliasDomain =
'proxy.localhost:8080';
172 $instance =
'master';
178 $this->
settings->setIliasUrl($iliasDomain);
179 $this->
settings->setInstance($instance);
181 $this->
settings->setIliasUrlEnabled(
false);
193 $this->
settings->setIliasUrlEnabled(
false);
195 '%s%s:%s%s/%s/%s/%s',
204 $this->assertEquals($expected, $this->
settings->getURL(
$action, $scope));
206 $this->
settings->setIliasUrlEnabled(
true);
217 $this->
settings->setIliasUrlEnabled(
true);
227 $this->assertEquals($expected, $this->
settings->getURL(
$action, $scope));
testGenerateClientUrlIfEnabled()
setterAndGettersProvider()
testSettersAndGetters($property, $type, $value)
testGenerateIliasUrlIfEnabled()
testGenerateIliasUrlIfDisabled()
Create styles array
The data for the language used.
Class ilChatroomServerSettings.
Class ilChatroomServerSettingsTest.
testGenerateClientUrlIfDisabled()
if(!array_key_exists('domain', $_REQUEST)) $domain
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'