ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilChatroomServerSettingsTest Class Reference

Class ilChatroomServerSettingsTest. More...

+ Inheritance diagram for ilChatroomServerSettingsTest:
+ Collaboration diagram for ilChatroomServerSettingsTest:

Public Member Functions

 testConstructor ()
 
 setterAndGettersProvider ()
 
 testSettersAndGetters ($property, $type, $value)
 
 testGetBaseUrl ()
 
 testGenerateClientUrlIfEnabled ()
 
 testGenerateClientUrlIfDisabled ()
 
 testGenerateIliasUrlIfEnabled ()
 
 testGenerateIliasUrlIfDisabled ()
 
 testGetUrl ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $settings
 

Detailed Description

Member Function Documentation

◆ setterAndGettersProvider()

ilChatroomServerSettingsTest::setterAndGettersProvider ( )

Definition at line 33 of file class.ilChatroomServerSettingsTest.php.

34 {
35 return array(
36 array('port', 'integer', 7373),
37 array('protocol', 'string', 'http://'), //@todo Remove :// from protocol
38 array('domain', 'string', '127.0.0.1'),
39
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),
47
48 //@TODO Remove this properties
49 array('instance', 'string', '123456'),
50 );
51 }

◆ setUp()

ilChatroomServerSettingsTest::setUp ( )
protected

Definition at line 14 of file class.ilChatroomServerSettingsTest.php.

15 {
16 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
17 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
18 ilUnitUtil::performInitialisation();
19 } else {
20 chdir(dirname(__FILE__));
21 chdir('../../../');
22 }
23
24 require_once './Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
26 }
Class ilChatroomServerSettings.
settings()
Definition: settings.php:2

References settings().

+ Here is the call graph for this function:

◆ testConstructor()

ilChatroomServerSettingsTest::testConstructor ( )

Definition at line 28 of file class.ilChatroomServerSettingsTest.php.

29 {
30 $this->assertInstanceOf('ilChatroomServerSettings', $this->settings);
31 }

References settings().

+ Here is the call graph for this function:

◆ testGenerateClientUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfDisabled ( )

Definition at line 114 of file class.ilChatroomServerSettingsTest.php.

115 {
116 $protocol = 'http://';
117 $domain = '127.0.0.1';
118 $clientDomain = 'proxy.localhost';
119 $port = '7373';
120 $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
121
122 $this->settings->setClientUrlEnabled(false);
123 $this->settings->setDomain($domain);
124 $this->settings->setPort($port);
125 $this->settings->setProtocol($protocol);
126 $this->settings->setClientUrl(sprintf('%s:%s', $clientDomain, $port));
127
128 $this->assertEquals($expected, $this->settings->generateClientUrl());
129 }

References settings().

+ Here is the call graph for this function:

◆ testGenerateClientUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfEnabled ( )

Definition at line 97 of file class.ilChatroomServerSettingsTest.php.

98 {
99 $protocol = 'http://';
100 $domain = '127.0.0.1';
101 $clientDomain = 'proxy.localhost';
102 $port = '7373';
103 $expected = sprintf('%s%s:%s', $protocol, $clientDomain, $port);
104
105 $this->settings->setClientUrlEnabled(true);
106 $this->settings->setProtocol($protocol);
107 $this->settings->setDomain($domain);
108 $this->settings->setPort($port);
109 $this->settings->setClientUrl(sprintf('%s:%s', $clientDomain, $port));
110
111 $this->assertEquals($expected, $this->settings->generateClientUrl());
112 }

References settings().

+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfDisabled ( )

Definition at line 148 of file class.ilChatroomServerSettingsTest.php.

149 {
150 $protocol = 'http://';
151 $domain = '127.0.0.1';
152 $iliasDomain = 'proxy.localhost';
153 $port = '7373';
154 $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
155
156 $this->settings->setIliasUrlEnabled(false);
157 $this->settings->setDomain($domain);
158 $this->settings->setPort($port);
159 $this->settings->setProtocol($protocol);
160 $this->settings->setIliasUrl(sprintf('%s:%s', $iliasDomain, $port));
161
162 $this->assertEquals($expected, $this->settings->generateIliasUrl());
163 }

References settings().

+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfEnabled ( )

Definition at line 131 of file class.ilChatroomServerSettingsTest.php.

132 {
133 $protocol = 'http://';
134 $domain = '127.0.0.1';
135 $iliasDomain = 'proxy.localhost';
136 $port = '7373';
137 $expected = sprintf('%s%s:%s', $protocol, $iliasDomain, $port);
138
139 $this->settings->setIliasUrlEnabled(true);
140 $this->settings->setProtocol($protocol);
141 $this->settings->setDomain($domain);
142 $this->settings->setPort($port);
143 $this->settings->setIliasUrl(sprintf('%s:%s', $iliasDomain, $port));
144
145 $this->assertEquals($expected, $this->settings->generateIliasUrl());
146 }

References settings().

+ Here is the call graph for this function:

◆ testGetBaseUrl()

ilChatroomServerSettingsTest::testGetBaseUrl ( )

Definition at line 83 of file class.ilChatroomServerSettingsTest.php.

84 {
85 $protocol = 'http://';
86 $domain = '127.0.0.1';
87 $port = '7373';
88 $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
89
90 $this->settings->setProtocol($protocol);
91 $this->settings->setDomain($domain);
92 $this->settings->setPort($port);
93
94 $this->assertEquals($expected, $this->settings->getBaseURL());
95 }

References settings().

+ Here is the call graph for this function:

◆ testGetUrl()

ilChatroomServerSettingsTest::testGetUrl ( )

Definition at line 165 of file class.ilChatroomServerSettingsTest.php.

166 {
167 $protocol = 'http://';
168 $domain = '127.0.0.1';
169 $iliasDomain = 'proxy.localhost:8080';
170 $port = 7373;
171 $action = 'Heartbeat';
172 $instance = 'master';
173 $scope = 123;
174
175 $this->settings->setProtocol($protocol . '');
176 $this->settings->setDomain($domain);
177 $this->settings->setPort($port);
178 $this->settings->setIliasUrl($iliasDomain);
179 $this->settings->setInstance($instance);
180
181 $this->settings->setIliasUrlEnabled(false);
182 $expected = sprintf(
183 '%s%s:%s%s/%s/%s',
184 $protocol,
185 $domain,
186 $port,
188 $action,
189 $instance
190 );
191 $this->assertEquals($expected, $this->settings->getURL($action));
192
193 $this->settings->setIliasUrlEnabled(false);
194 $expected = sprintf(
195 '%s%s:%s%s/%s/%s/%s',
196 $protocol,
197 $domain,
198 $port,
200 $action,
201 $instance,
202 $scope
203 );
204 $this->assertEquals($expected, $this->settings->getURL($action, $scope));
205
206 $this->settings->setIliasUrlEnabled(true);
207 $expected = sprintf(
208 '%s%s%s/%s/%s',
209 $protocol,
210 $iliasDomain,
212 $action,
213 $instance
214 );
215 $this->assertEquals($expected, $this->settings->getURL($action));
216
217 $this->settings->setIliasUrlEnabled(true);
218 $expected = sprintf(
219 '%s%s%s/%s/%s/%s',
220 $protocol,
221 $iliasDomain,
223 $action,
224 $instance,
225 $scope
226 );
227 $this->assertEquals($expected, $this->settings->getURL($action, $scope));
228 }

References ilChatroomServerSettings\PREFIX, and settings().

+ Here is the call graph for this function:

◆ testSettersAndGetters()

ilChatroomServerSettingsTest::testSettersAndGetters (   $property,
  $type,
  $value 
)
Parameters
string$property
string$type
mixed$value@dataProvider setterAndGettersProvider

Definition at line 59 of file class.ilChatroomServerSettingsTest.php.

60 {
61 $setter = 'set' . ucfirst($property);
62 $getter = 'get' . ucfirst(($property));
63
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));
66
67 $this->settings->$setter($value);
68 $actual = $this->settings->$getter();
69
70 $this->assertEquals($value, $actual, sprintf('The expected value "%s" is not equals to "%s"', $value, $actual));
71
72 if (class_exists($type)) {
73 $this->assertInstanceOf(
74 $type,
75 $actual,
76 sprintf('The actual return value is not an instance of "%s"', $type)
77 );
78 } else {
79 $this->assertInternalType($type, $actual, sprintf('The actual return value is not a type of "%s"', $type));
80 }
81 }
$type

References $type, and settings().

+ Here is the call graph for this function:

Field Documentation

◆ $settings

ilChatroomServerSettingsTest::$settings
protected

Definition at line 12 of file class.ilChatroomServerSettingsTest.php.


The documentation for this class was generated from the following file: