29 $this->
refinery =
new Refinery($this->createMock(DataFactory::class), $this->createMock(\ilLanguage::class));
36 $this->assertInstanceOf(\ilGlobalCacheSetupAgent::class, $this->obj);
41 $this->assertTrue($this->obj->hasConfig());
46 $fnc = $this->obj->getArrayToConfigTransformation();
50 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
51 $this->assertFalse(
$settings->isActive());
56 $fnc = $this->obj->getArrayToConfigTransformation();
60 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
61 $this->assertFalse(
$settings->isActive());
66 $fnc = $this->obj->getArrayToConfigTransformation();
70 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
71 $this->assertFalse(
$settings->isActive());
76 $fnc = $this->obj->getArrayToConfigTransformation();
78 $settings = $fnc([
"service" =>
"memcached"]);
80 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
81 $this->assertFalse(
$settings->isActive());
86 $fnc = $this->obj->getArrayToConfigTransformation();
88 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => null]);
90 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
91 $this->assertFalse(
$settings->isActive());
96 $fnc = $this->obj->getArrayToConfigTransformation();
98 $settings = $fnc([
"service" =>
"memcached",
"memcached_nodes" => []]);
100 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
101 $this->assertFalse(
$settings->isActive());
106 $fnc = $this->obj->getArrayToConfigTransformation();
125 "memcached_nodes" => [$node],
126 "components" => [
"dummy"]
129 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
136 $fnc = $this->obj->getArrayToConfigTransformation();
145 $this->expectException(\InvalidArgumentException::class);
146 $this->expectExceptionMessage(
"Unknown caching service: 'non_existing_service'");
150 "service" =>
"non_existing_service",
151 "memcached_nodes" => [$node],
152 "components" => [
"dummy"]
159 $fnc = $this->obj->getArrayToConfigTransformation();
170 "service" =>
"memcached",
171 "memcached_nodes" => [$node],
172 "components" => [
"dummy"]
176 $this->assertInstanceOf(\ilGlobalCacheSettings::class,
$settings);
177 $this->assertIsArray(
$settings->getMemcachedNodes());
179 $settings = $settings->getMemcachedNodes();
180 $node = array_shift($settings);
182 $this->assertEquals(
"1", $node->getStatus());
183 $this->assertEquals(
"test.de", $node->getHost());
184 $this->assertEquals(
"9874", $node->getPort());
185 $this->assertEquals(
"10", $node->getWeight());
192 "host" =>
"my.test.de",
197 $result = $this->obj->getMServer($node);
200 $this->assertEquals(
"my.test.de", $result->getHost());
201 $this->assertEquals(
"1111", $result->getPort());
202 $this->assertEquals(
"20", $result->getWeight());
209 "host" =>
"my.test.de",
214 $result = $this->obj->getMServer($node);
217 $this->assertEquals(
"my.test.de", $result->getHost());
218 $this->assertEquals(
"1111", $result->getPort());
219 $this->assertEquals(
"20", $result->getWeight());
224 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettings::class);
225 $objective_collection = $this->obj->getInstallObjective($setup_conf_mock);
227 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
228 $this->assertFalse($objective_collection->isNotable());
233 $setup_conf_mock = $this->createMock(\ilGlobalCacheSettings::class);
234 $objective_collection = $this->obj->getUpdateObjective($setup_conf_mock);
236 $this->assertEquals(
'Store configuration of Services/GlobalCache', $objective_collection->getLabel());
237 $this->assertFalse($objective_collection->isNotable());
242 $objective_collection = $this->obj->getUpdateObjective();
244 $this->assertInstanceOf(NullObjective::class, $objective_collection);
250 $objective_collection = $this->obj->getBuildArtifactObjective();
252 $this->assertInstanceOf(NullObjective::class, $objective_collection);
testGetArrayToConfigTransformationWithNullMemcachedData()
testGetBuildArtifactObjective()
testGetArrayToConfigTransformationWithServiceException()
testGetArrayToConfigTransformationWithEmptyDataArray()
testGetArrayToConfigTransformationWithEmptyMemcachedDataArray()
testGetArrayToConfigTransformationWithDataServices()
testGetArrayToConfigTransformationWithNullData()
testGetArrayToConfigTransformationWithMemcachedNode()
testGetMemcachedServerInactive()
getMemcachedServer(array $node)
testGetInstallObjectives()
testGetArrayToConfigTransformationWithNullComponents()
testGetArrayToConfigTransformationWithNullMemcachedDataArray()
testGetUpdateObjectiveWithoutConfig()
testGetMemcachedServerActive()