ILIAS  release_8 Revision v8.24
ilChatroomServerSettingsTest Class Reference

Class ilChatroomServerSettingsTest. More...

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

Public Member Functions

 setterAndGettersProvider ()
 
 testSettersAndGetters (string $property, callable $assertionCallback, $value)
 
 testGetBaseUrl ()
 
 testGenerateClientUrlIfEnabled ()
 
 testGenerateClientUrlIfDisabled ()
 
 testGenerateIliasUrlIfEnabled ()
 
 testGenerateIliasUrlIfDisabled ()
 
 testGetUrl ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

ilChatroomServerSettings $settings
 

Detailed Description

Member Function Documentation

◆ setterAndGettersProvider()

ilChatroomServerSettingsTest::setterAndGettersProvider ( )

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

31 : array
32 {
33 $assertIsString = function ($actual): void {
34 $this->assertIsString($actual, 'The actual return value is not a type of "string"');
35 };
36
37 $assertIsInteger = function ($actual): void {
38 $this->assertIsInt($actual, 'The actual return value is not a type of "int"');
39 };
40
41 $assertIsBool = function ($actual): void {
42 $this->assertIsBool($actual, 'The actual return value is not a type of "bool"');
43 };
44
45 return [
46 ['port', $assertIsInteger, 7373],
47 ['protocol', $assertIsString, 'http://'],
48 ['domain', $assertIsString, '127.0.0.1'],
49
50 ['authKey', $assertIsString, 'cfdf79fc-4133-4f3b-882f-5162a87dc465'],
51 ['authSecret', $assertIsString, 'f8072a49-0488-411f-be0a-723a762700ba'],
52 ['clientUrlEnabled', $assertIsBool, true],
53 ['clientUrl', $assertIsString, 'http://proxy.localhost'],
54 ['iliasUrlEnabled', $assertIsBool, true],
55 ['iliasUrl', $assertIsString, 'http://proxy.localhost'],
56 ['smiliesEnabled', $assertIsBool, false],
57
58 //@TODO Remove this properties
59 ['instance', $assertIsString, '123456'],
60 ];
61 }

◆ setUp()

ilChatroomServerSettingsTest::setUp ( )
protected

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

232 : void
233 {
234 parent::setUp();
235
236 $this->settings = new ilChatroomServerSettings();
237 }
Class ilChatroomServerSettings.

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGenerateClientUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfDisabled ( )

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

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

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGenerateClientUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfEnabled ( )

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

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

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfDisabled ( )

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

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

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfEnabled ( )

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

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

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGetBaseUrl()

ilChatroomServerSettingsTest::testGetBaseUrl ( )

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

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

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testGetUrl()

ilChatroomServerSettingsTest::testGetUrl ( )

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

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

References $scope, ilChatroomServerSettings\PREFIX, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ testSettersAndGetters()

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

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

69 : void
70 {
71 $setter = 'set' . ucfirst($property);
72 $getter = 'get' . ucfirst(($property));
73
74 $this->assertTrue(method_exists($this->settings, $setter), sprintf('The Setter "%s" does not exist', $setter));
75 $this->assertTrue(method_exists($this->settings, $getter), sprintf('The Getter "%s" does not exist', $setter));
76
77 $this->settings->$setter($value);
78 $actual = $this->settings->$getter();
79
80 $this->assertSame($value, $actual, sprintf('The expected value "%s" is not equals to "%s"', $value, $actual));
81
82 $assertionCallback($actual);
83 }

References ILIAS\Repository\settings().

+ Here is the call graph for this function:

Field Documentation

◆ $settings

ilChatroomServerSettings ilChatroomServerSettingsTest::$settings
protected

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


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