43 $this->refinery =
new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
45 $this->obj =
new TestObj($this->refinery);
50 $this->assertInstanceOf(\ilGlobalCacheSetupAgent::class, $this->obj);
55 $this->assertTrue($this->obj->hasConfig());
60 $fnc = $this->obj->getArrayToConfigTransformation();
62 $settings = $fnc(null);
64 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
65 $this->assertFalse($settings->isActive());
70 $fnc = $this->obj->getArrayToConfigTransformation();
74 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
75 $this->assertFalse($settings->isActive());
80 $fnc = $this->obj->getArrayToConfigTransformation();
82 $settings = $fnc([
"components" => null]);
84 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
85 $this->assertFalse($settings->isActive());
90 $fnc = $this->obj->getArrayToConfigTransformation();
92 $settings = $fnc([
"service" =>
"memcached"]);
94 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
95 $this->assertFalse($settings->isActive());
100 $fnc = $this->obj->getArrayToConfigTransformation();
102 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => null]);
104 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
105 $this->assertFalse($settings->isActive());
110 $fnc = $this->obj->getArrayToConfigTransformation();
112 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => []]);
114 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
115 $this->assertFalse($settings->isActive());
120 $fnc = $this->obj->getArrayToConfigTransformation();
136 foreach ($services as $key =>
$service) {
140 "memcached_nodes" => [$node],
141 "components" => [
"dummy"]
144 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
145 $this->assertEquals($key, $settings->getService());
151 $fnc = $this->obj->getArrayToConfigTransformation();
160 $this->expectException(\InvalidArgumentException::class);
161 $this->expectExceptionMessage(
"Unknown caching service: 'non_existing_service'");
165 "service" =>
"non_existing_service",
166 "memcached_nodes" => [$node],
167 "components" => [
"dummy"]
174 $fnc = $this->obj->getArrayToConfigTransformation();
185 "service" =>
"memcached",
186 "memcached_nodes" => [$node],
187 "components" => [
"dummy"]
191 $this->assertInstanceOf(\ilGlobalCacheSettings::class, $settings);
192 $memcached_nodes = $settings->getMemcachedNodes();
194 $this->assertIsArray($memcached_nodes);
196 $node = array_shift($memcached_nodes);
198 $this->assertEquals(
"1", $node->getStatus());
199 $this->assertEquals(
"test.de", $node->getHost());
200 $this->assertEquals(
"9874", $node->getPort());
201 $this->assertEquals(
"10", $node->getWeight());
208 "host" =>
"my.test.de",
213 $result = $this->obj->getMServer($node);
216 $this->assertEquals(
"my.test.de",
$result->getHost());
217 $this->assertEquals(
"1111",
$result->getPort());
218 $this->assertEquals(
"20",
$result->getWeight());
225 "host" =>
"my.test.de",
230 $result = $this->obj->getMServer($node);
233 $this->assertEquals(
"my.test.de",
$result->getHost());
234 $this->assertEquals(
"1111",
$result->getPort());
235 $this->assertEquals(
"20",
$result->getWeight());
240 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettings::class);
241 $objective_collection = $this->obj->getInstallObjective($setup_conf_mock);
243 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
244 $this->assertFalse($objective_collection->isNotable());
249 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettings::class);
250 $objective_collection = $this->obj->getUpdateObjective($setup_conf_mock);
252 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
253 $this->assertFalse($objective_collection->isNotable());
258 $objective_collection = $this->obj->getUpdateObjective();
260 $this->assertInstanceOf(NullObjective::class, $objective_collection);
266 $objective_collection = $this->obj->getBuildArtifactObjective();
268 $this->assertInstanceOf(NullObjective::class, $objective_collection);
testGetArrayToConfigTransformationWithNullMemcachedData()
testGetBuildArtifactObjective()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testGetArrayToConfigTransformationWithServiceException()
testGetArrayToConfigTransformationWithEmptyDataArray()
testGetArrayToConfigTransformationWithEmptyMemcachedDataArray()
testGetArrayToConfigTransformationWithDataServices()
testGetArrayToConfigTransformationWithNullData()
testGetArrayToConfigTransformationWithMemcachedNode()
testGetMemcachedServerInactive()
getMemcachedServer(array $node)
testGetInstallObjectives()
testGetArrayToConfigTransformationWithNullComponents()
testGetArrayToConfigTransformationWithNullMemcachedDataArray()
testGetUpdateObjectiveWithoutConfig()
testGetMemcachedServerActive()