44 $this->
refinery =
new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
51 $this->assertInstanceOf(\ilGlobalCacheSetupAgent::class, $this->obj);
56 $this->assertTrue($this->obj->hasConfig());
59 public function testGetArrayToConfigTransformationWithNullData():
void 62 $fnc = $this->obj->getArrayToConfigTransformation();
66 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
67 $this->assertFalse($config->isActivated());
70 public function testGetArrayToConfigTransformationWithEmptyDataArray():
void 73 $fnc = $this->obj->getArrayToConfigTransformation();
77 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
78 $this->assertFalse($config->isActivated());
81 public function testGetArrayToConfigTransformationWithNullComponents():
void 84 $fnc = $this->obj->getArrayToConfigTransformation();
88 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
89 $this->assertFalse($config->isActivated());
92 public function testGetArrayToConfigTransformationWithNullMemcachedData():
void 95 $fnc = $this->obj->getArrayToConfigTransformation();
96 $settings = $fnc([
"service" =>
"memcached"]);
99 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
100 $this->assertFalse($config->isActivated());
103 public function testGetArrayToConfigTransformationWithNullMemcachedDataArray():
void 106 $fnc = $this->obj->getArrayToConfigTransformation();
107 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => null]);
110 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
111 $this->assertFalse($config->isActivated());
114 public function testGetArrayToConfigTransformationWithEmptyMemcachedDataArray():
void 117 $fnc = $this->obj->getArrayToConfigTransformation();
118 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => []]);
121 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
122 $this->assertFalse($config->isActivated());
125 public function testGetArrayToConfigTransformationWithDataServices():
void 142 $fnc = $this->obj->getArrayToConfigTransformation();
147 "memcached_nodes" => [$node],
148 "components" => [
"dummy" =>
true]
152 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
153 $this->assertEquals(
$key, $config->getAdaptorName());
159 $fnc = $this->obj->getArrayToConfigTransformation();
168 $this->expectException(\InvalidArgumentException::class);
169 $this->expectExceptionMessage(
"Unknown caching service: 'non_existing_service'");
173 "service" =>
"non_existing_service",
174 "memcached_nodes" => [$node],
175 "components" => [
"dummy"]
182 $fnc = $this->obj->getArrayToConfigTransformation();
193 "service" =>
"memcached",
194 "memcached_nodes" => [$node],
195 "components" => [
"dummy" =>
true]
199 $this->assertInstanceOf(\ilGlobalCacheSettingsAdapter::class,
$settings);
200 $this->assertIsArray(
$settings->getMemcachedNodes());
202 $settings = $settings->getMemcachedNodes();
203 $node = array_shift($settings);
205 $this->assertEquals(
"test.de", $node->getHost());
206 $this->assertEquals(
"9874", $node->getPort());
207 $this->assertEquals(
"10", $node->getWeight());
214 "host" =>
"my.test.de",
219 $result = $this->obj->getMServer($node);
221 $this->assertEquals(
"my.test.de", $result->getHost());
222 $this->assertEquals(
"1111", $result->getPort());
223 $this->assertEquals(
"20", $result->getWeight());
230 "host" =>
"my.test.de",
235 $result = $this->obj->getMServer($node);
237 $this->assertEquals(
"my.test.de", $result->getHost());
238 $this->assertEquals(
"1111", $result->getPort());
239 $this->assertEquals(
"20", $result->getWeight());
244 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
245 $objective_collection = $this->obj->getInstallObjective($setup_conf_mock);
247 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
248 $this->assertFalse($objective_collection->isNotable());
253 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettingsAdapter::class);
254 $objective_collection = $this->obj->getUpdateObjective($setup_conf_mock);
256 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
257 $this->assertFalse($objective_collection->isNotable());
262 $objective_collection = $this->obj->getUpdateObjective();
264 $this->assertInstanceOf(NullObjective::class, $objective_collection);
270 $objective_collection = $this->obj->getBuildArtifactObjective();
272 $this->assertInstanceOf(NullObjective::class, $objective_collection);
testGetBuildArtifactObjective()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testGetArrayToConfigTransformationWithServiceException()
testGetArrayToConfigTransformationWithMemcachedNode()
testGetMemcachedServerInactive()
testGetInstallObjectives()
testGetUpdateObjectiveWithoutConfig()
testGetMemcachedServerActive()