ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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
 

Private Attributes

Refinery $refinery
 

Detailed Description

Definition at line 36 of file ilGlobalCacheSetupAgentTest.php.

Member Function Documentation

◆ setUp()

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

Definition at line 44 of file ilGlobalCacheSetupAgentTest.php.

References ILIAS\Repository\refinery().

44  : void
45  {
46  $this->refinery = new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
47 
48  $this->obj = new TestObj($this->refinery);
49  }
+ Here is the call graph for this function:

◆ testCreate()

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

Definition at line 51 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetArrayToConfigTransformationWithMemcachedNode()

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

Definition at line 182 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetArrayToConfigTransformationWithServiceException()

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

Definition at line 159 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetBuildArtifactObjective()

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

Definition at line 270 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetInstallObjectives()

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

Definition at line 244 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetMemcachedServerActive()

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

Definition at line 212 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetMemcachedServerInactive()

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

Definition at line 228 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetUpdateObjective()

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

Definition at line 253 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testGetUpdateObjectiveWithoutConfig()

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

Definition at line 262 of file ilGlobalCacheSetupAgentTest.php.

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

◆ testHasConfig()

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

Definition at line 56 of file ilGlobalCacheSetupAgentTest.php.

References $service, ILIAS\Cache\Config\APCU, ILIAS\Cache\Config\MEMCACHED, null, and ILIAS\Cache\Config\PHPSTATIC.

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

Field Documentation

◆ $obj

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

Definition at line 42 of file ilGlobalCacheSetupAgentTest.php.

◆ $refinery

Refinery ILIAS\Tests\GlobalCache\Setup\ilGlobalCacheSetupAgentTest::$refinery
private

Definition at line 38 of file ilGlobalCacheSetupAgentTest.php.


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