16 if(
defined(
'ILIAS_PHPUNIT_CONTEXT'))
18 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
23 chdir(dirname(__FILE__));
27 require_once
'./Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
33 $this->assertInstanceOf(
'ilChatroomServerSettings', $this->
settings);
39 array(
'port',
'integer', 7373),
40 array(
'protocol',
'string',
'http://'),
41 array(
'domain',
'string',
'127.0.0.1'),
43 array(
'authKey',
'string',
'cfdf79fc-4133-4f3b-882f-5162a87dc465'),
44 array(
'authSecret',
'string',
'f8072a49-0488-411f-be0a-723a762700ba'),
45 array(
'clientUrlEnabled',
'boolean',
true),
46 array(
'clientUrl',
'string',
'http://proxy.localhost'),
47 array(
'iliasUrlEnabled',
'boolean',
true),
48 array(
'iliasUrl',
'string',
'http://proxy.localhost'),
49 array(
'smiliesEnabled',
'boolean',
false),
52 array(
'instance',
'string',
'123456'),
64 $setter =
'set' . ucfirst($property);
65 $getter =
'get' . ucfirst(($property));
67 $this->assertTrue(method_exists($this->
settings, $setter), sprintf(
'The Setter "%s" does not exist', $setter));
68 $this->assertTrue(method_exists($this->
settings, $getter), sprintf(
'The Getter "%s" does not exist', $setter));
71 $actual = $this->
settings->$getter();
73 $this->assertEquals($value, $actual, sprintf(
'The expected value "%s" is not equals to "%s"', $value, $actual));
75 if(class_exists($type))
77 $this->assertInstanceOf(
80 sprintf(
'The actual return value is not an instance of "%s"', $type)
85 $this->assertInternalType($type, $actual, sprintf(
'The actual return value is not a type of "%s"', $type));
91 $protocol =
'http://';
92 $domain =
'127.0.0.1';
94 $expected = sprintf(
'%s%s:%s', $protocol, $domain, $port);
96 $this->
settings->setProtocol($protocol);
100 $this->assertEquals($expected, $this->
settings->getBaseURL());
105 $protocol =
'http://';
106 $domain =
'127.0.0.1';
107 $clientDomain =
'proxy.localhost';
109 $expected = sprintf(
'%s%s:%s', $protocol, $clientDomain, $port);
111 $this->
settings->setClientUrlEnabled(
true);
112 $this->
settings->setProtocol($protocol);
113 $this->
settings->setDomain($domain);
115 $this->
settings->setClientUrl(sprintf(
'%s:%s', $clientDomain, $port));
117 $this->assertEquals($expected, $this->
settings->generateClientUrl());
122 $protocol =
'http://';
123 $domain =
'127.0.0.1';
124 $clientDomain =
'proxy.localhost';
126 $expected = sprintf(
'%s%s:%s', $protocol, $domain, $port);
128 $this->
settings->setClientUrlEnabled(
false);
129 $this->
settings->setDomain($domain);
131 $this->
settings->setProtocol($protocol);
132 $this->
settings->setClientUrl(sprintf(
'%s:%s', $clientDomain, $port));
134 $this->assertEquals($expected, $this->
settings->generateClientUrl());
139 $protocol =
'http://';
140 $domain =
'127.0.0.1';
141 $iliasDomain =
'proxy.localhost';
143 $expected = sprintf(
'%s%s:%s', $protocol, $iliasDomain, $port);
145 $this->
settings->setIliasUrlEnabled(
true);
146 $this->
settings->setProtocol($protocol);
147 $this->
settings->setDomain($domain);
149 $this->
settings->setIliasUrl(sprintf(
'%s:%s', $iliasDomain, $port));
151 $this->assertEquals($expected, $this->
settings->generateIliasUrl());
156 $protocol =
'http://';
157 $domain =
'127.0.0.1';
158 $iliasDomain =
'proxy.localhost';
160 $expected = sprintf(
'%s%s:%s', $protocol, $domain, $port);
162 $this->
settings->setIliasUrlEnabled(
false);
163 $this->
settings->setDomain($domain);
165 $this->
settings->setProtocol($protocol);
166 $this->
settings->setIliasUrl(sprintf(
'%s:%s', $iliasDomain, $port));
168 $this->assertEquals($expected, $this->
settings->generateIliasUrl());
173 $protocol =
'http://';
174 $domain =
'127.0.0.1';
175 $iliasDomain =
'proxy.localhost:8080';
177 $action =
'Heartbeat';
178 $instance =
'master';
181 $this->
settings->setProtocol($protocol .
'');
182 $this->
settings->setDomain($domain);
184 $this->
settings->setIliasUrl($iliasDomain);
185 $this->
settings->setInstance($instance);
187 $this->
settings->setIliasUrlEnabled(
false);
197 $this->assertEquals($expected, $this->
settings->getURL($action));
199 $this->
settings->setIliasUrlEnabled(
false);
201 '%s%s:%s%s/%s/%s/%s',
210 $this->assertEquals($expected, $this->
settings->getURL($action, $scope));
212 $this->
settings->setIliasUrlEnabled(
true);
221 $this->assertEquals($expected, $this->
settings->getURL($action));
223 $this->
settings->setIliasUrlEnabled(
true);
233 $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()
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'