ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ilChatroomServerSettingsTest Class Reference
+ Inheritance diagram for ilChatroomServerSettingsTest:
+ Collaboration diagram for ilChatroomServerSettingsTest:

Public Member Functions

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

Static Public Member Functions

static setterAndGettersProvider ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

ilChatroomServerSettings $settings
 

Detailed Description

Definition at line 24 of file ilChatroomServerSettingsTest.php.

Member Function Documentation

◆ setterAndGettersProvider()

static ilChatroomServerSettingsTest::setterAndGettersProvider ( )
static
Returns
list<array{0: string, 1: callable(mixed): void, 2: mixed}>

Definition at line 31 of file ilChatroomServerSettingsTest.php.

31  : array
32  {
33  $assertIsString = static function ($actual): void {
34  self::assertIsString($actual, 'The actual return value is not a type of "string"');
35  };
36 
37  $assertIsInteger = static function ($actual): void {
38  self::assertIsInt($actual, 'The actual return value is not a type of "int"');
39  };
40 
41  $assertIsBool = static function ($actual): void {
42  self::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  //@TODO Remove this properties
57  ['instance', $assertIsString, '123456'],
58  ];
59  }

◆ setUp()

ilChatroomServerSettingsTest::setUp ( )
protected

Definition at line 229 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

229  : void
230  {
231  parent::setUp();
232 
233  $this->settings = new ilChatroomServerSettings();
234  }
+ Here is the call graph for this function:

◆ testGenerateClientUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfDisabled ( )

Definition at line 113 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

113  : void
114  {
115  $protocol = 'http://';
116  $domain = '127.0.0.1';
117  $clientDomain = 'proxy.localhost';
118  $port = 7373;
119  $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
120 
121  $this->settings->setClientUrlEnabled(false);
122  $this->settings->setDomain($domain);
123  $this->settings->setPort($port);
124  $this->settings->setProtocol($protocol);
125  $this->settings->setClientUrl(sprintf('%s:%s', $clientDomain, $port));
126 
127  $this->assertSame($expected, $this->settings->generateClientUrl());
128  }
+ Here is the call graph for this function:

◆ testGenerateClientUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateClientUrlIfEnabled ( )

Definition at line 96 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

96  : void
97  {
98  $protocol = 'http://';
99  $domain = '127.0.0.1';
100  $clientDomain = 'proxy.localhost';
101  $port = 7373;
102  $expected = sprintf('%s%s:%s', $protocol, $clientDomain, $port);
103 
104  $this->settings->setClientUrlEnabled(true);
105  $this->settings->setProtocol($protocol);
106  $this->settings->setDomain($domain);
107  $this->settings->setPort($port);
108  $this->settings->setClientUrl(sprintf('%s:%s', $clientDomain, $port));
109 
110  $this->assertSame($expected, $this->settings->generateClientUrl());
111  }
+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfDisabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfDisabled ( )

Definition at line 147 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

147  : void
148  {
149  $protocol = 'http://';
150  $domain = '127.0.0.1';
151  $iliasDomain = 'proxy.localhost';
152  $port = 7373;
153  $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
154 
155  $this->settings->setIliasUrlEnabled(false);
156  $this->settings->setDomain($domain);
157  $this->settings->setPort($port);
158  $this->settings->setProtocol($protocol);
159  $this->settings->setIliasUrl(sprintf('%s:%s', $iliasDomain, $port));
160 
161  $this->assertSame($expected, $this->settings->generateIliasUrl());
162  }
+ Here is the call graph for this function:

◆ testGenerateIliasUrlIfEnabled()

ilChatroomServerSettingsTest::testGenerateIliasUrlIfEnabled ( )

Definition at line 130 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

130  : void
131  {
132  $protocol = 'http://';
133  $domain = '127.0.0.1';
134  $iliasDomain = 'proxy.localhost';
135  $port = 7373;
136  $expected = sprintf('%s%s:%s', $protocol, $iliasDomain, $port);
137 
138  $this->settings->setIliasUrlEnabled(true);
139  $this->settings->setProtocol($protocol);
140  $this->settings->setDomain($domain);
141  $this->settings->setPort($port);
142  $this->settings->setIliasUrl(sprintf('%s:%s', $iliasDomain, $port));
143 
144  $this->assertSame($expected, $this->settings->generateIliasUrl());
145  }
+ Here is the call graph for this function:

◆ testGetBaseUrl()

ilChatroomServerSettingsTest::testGetBaseUrl ( )

Definition at line 82 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

82  : void
83  {
84  $protocol = 'http://';
85  $domain = '127.0.0.1';
86  $port = 7373;
87  $expected = sprintf('%s%s:%s', $protocol, $domain, $port);
88 
89  $this->settings->setProtocol($protocol);
90  $this->settings->setDomain($domain);
91  $this->settings->setPort($port);
92 
93  $this->assertSame($expected, $this->settings->getBaseURL());
94  }
+ Here is the call graph for this function:

◆ testGetUrl()

ilChatroomServerSettingsTest::testGetUrl ( )

Definition at line 164 of file ilChatroomServerSettingsTest.php.

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

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

◆ testSettersAndGetters()

ilChatroomServerSettingsTest::testSettersAndGetters ( string  $property,
callable  $assertionCallback,
  $value 
)
Parameters
callable(mixed)void $assertionCallback
mixed$value

Definition at line 66 of file ilChatroomServerSettingsTest.php.

References ILIAS\Repository\settings().

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

Field Documentation

◆ $settings

ilChatroomServerSettings ilChatroomServerSettingsTest::$settings
protected

Definition at line 26 of file ilChatroomServerSettingsTest.php.


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