ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest Class Reference
+ Inheritance diagram for ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest:
+ Collaboration diagram for ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest:

Public Member Functions

 setUp ()
 
 testCreate ()
 
 testHasConfig ()
 
 testGetArrayToConfigTransformationWithServiceException ()
 
 testGetArrayToConfigTransformationWithMemcachedNode ()
 
 testGetMemcachedServerActive ()
 
 testGetMemcachedServerInactive ()
 
 testGetInstallObjectives ()
 
 testGetUpdateObjective ()
 
 testGetUpdateObjectiveWithoutConfig ()
 
 testGetBuildArtifactObjective ()
 

Protected Attributes

 $obj
 

Detailed Description

Definition at line 36 of file ilGlobalCacheSetupAgentTest.php.

Member Function Documentation

◆ setUp()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::setUp ( )

Definition at line 43 of file ilGlobalCacheSetupAgentTest.php.

43 : void
44 {
45 $refinery = new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
46
47 $this->obj = new TestObj($refinery);
48 }

References ILIAS\UI\examples\Layout\Page\Standard\$refinery.

◆ testCreate()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testCreate ( )

Definition at line 50 of file ilGlobalCacheSetupAgentTest.php.

50 : void
51 {
52 $this->assertInstanceOf(\ilGlobalCacheSetupAgent::class, $this->obj);
53 }

◆ testGetArrayToConfigTransformationWithMemcachedNode()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetArrayToConfigTransformationWithMemcachedNode ( )

Definition at line 181 of file ilGlobalCacheSetupAgentTest.php.

181 : void
182 {
183 $fnc = $this->obj->getArrayToConfigTransformation();
184
185 $node = [
186 "active" => "1",
187 "host" => "test.de",
188 "port" => "9874",
189 "weight" => "10"
190 ];
191
192 $settings = $fnc(
193 [
194 "service" => "memcached",
195 "memcached_nodes" => [$node],
196 "components" => ["dummy" => true]
197 ]
198 );
199
200 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class, $settings);
201 $this->assertIsArray($settings->getMemcachedNodes());
202
203 $settings = $settings->getMemcachedNodes();
204 $node = array_shift($settings);
205
206 $this->assertEquals("test.de", $node->getHost());
207 $this->assertEquals("9874", $node->getPort());
208 $this->assertEquals("10", $node->getWeight());
209 }

◆ testGetArrayToConfigTransformationWithServiceException()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetArrayToConfigTransformationWithServiceException ( )

Definition at line 158 of file ilGlobalCacheSetupAgentTest.php.

158 : void
159 {
160 $fnc = $this->obj->getArrayToConfigTransformation();
161
162 $node = [
163 "active" => "1",
164 "host" => "test.de",
165 "port" => "9874",
166 "weight" => "10"
167 ];
168
169 $this->expectException(\InvalidArgumentException::class);
170 $this->expectExceptionMessage("Unknown caching service: 'non_existing_service'");
171
172 $fnc(
173 [
174 "service" => "non_existing_service",
175 "memcached_nodes" => [$node],
176 "components" => ["dummy"]
177 ]
178 );
179 }

◆ testGetBuildArtifactObjective()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetBuildArtifactObjective ( )

Definition at line 269 of file ilGlobalCacheSetupAgentTest.php.

269 : void
270 {
271 $objective_collection = $this->obj->getBuildObjective();
272
273 $this->assertInstanceOf(NullObjective::class, $objective_collection);
274 }

◆ testGetInstallObjectives()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetInstallObjectives ( )

Definition at line 243 of file ilGlobalCacheSetupAgentTest.php.

243 : void
244 {
245 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
246 $objective_collection = $this->obj->getInstallObjective($setup_conf_mock);
247
248 $this->assertEquals('Store configuration of components/ILIAS/GlobalCache_', $objective_collection->getLabel());
249 $this->assertFalse($objective_collection->isNotable());
250 }

◆ testGetMemcachedServerActive()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetMemcachedServerActive ( )

Definition at line 211 of file ilGlobalCacheSetupAgentTest.php.

211 : void
212 {
213 $node = $node = [
214 "active" => "1",
215 "host" => "my.test.de",
216 "port" => "1111",
217 "weight" => "20"
218 ];
219
220 $result = $this->obj->getMServer($node);
221
222 $this->assertEquals("my.test.de", $result->getHost());
223 $this->assertEquals("1111", $result->getPort());
224 $this->assertEquals("20", $result->getWeight());
225 }

◆ testGetMemcachedServerInactive()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetMemcachedServerInactive ( )

Definition at line 227 of file ilGlobalCacheSetupAgentTest.php.

227 : void
228 {
229 $node = $node = [
230 "active" => "0",
231 "host" => "my.test.de",
232 "port" => "1111",
233 "weight" => "20"
234 ];
235
236 $result = $this->obj->getMServer($node);
237
238 $this->assertEquals("my.test.de", $result->getHost());
239 $this->assertEquals("1111", $result->getPort());
240 $this->assertEquals("20", $result->getWeight());
241 }

◆ testGetUpdateObjective()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetUpdateObjective ( )

Definition at line 252 of file ilGlobalCacheSetupAgentTest.php.

252 : void
253 {
254 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
255 $objective_collection = $this->obj->getUpdateObjective($setup_conf_mock);
256
257 $this->assertEquals('Store configuration of components/ILIAS/GlobalCache_', $objective_collection->getLabel());
258 $this->assertFalse($objective_collection->isNotable());
259 }

◆ testGetUpdateObjectiveWithoutConfig()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testGetUpdateObjectiveWithoutConfig ( )

Definition at line 261 of file ilGlobalCacheSetupAgentTest.php.

261 : void
262 {
263 $objective_collection = $this->obj->getUpdateObjective();
264
265 $this->assertInstanceOf(NullObjective::class, $objective_collection);
266 }

◆ testHasConfig()

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::testHasConfig ( )

Definition at line 55 of file ilGlobalCacheSetupAgentTest.php.

55 : void
56 {
57 $this->assertTrue($this->obj->hasConfig());
58 }

Field Documentation

◆ $obj

ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::$obj
protected

Definition at line 41 of file ilGlobalCacheSetupAgentTest.php.


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