Skip to content

Commit 9a7393e

Browse files
committed
Fixed tests
1 parent d5a51aa commit 9a7393e

File tree

14 files changed

+28
-47
lines changed

14 files changed

+28
-47
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"greencape/php-versions": "@dev",
2323
"symfony/yaml": "^3.2",
2424
"greencape/joomla-cli": "^0.1.0",
25-
"alchemy/zippy": "^0.4.4"
25+
"alchemy/zippy": "^0.4.4",
26+
"ext-simplexml": "*"
2627
},
2728
"require-dev": {
2829
"phpunit/phpunit": "^5.7"

src/ServerConfig.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ServerConfig
3838
'joomla.version' => "latest",
3939
'memcached.enabled' => "0",
4040
'memcached.port' => "11211",
41-
'memcached.version' => "latest",
41+
'memcached.version' => "latest",
4242
'meta.description' => "Test installation",
4343
'meta.keywords' => "",
4444
'meta.showAuthor' => "1",
@@ -64,16 +64,18 @@ class ServerConfig
6464
'server.type' => "nginx",
6565
'session.handler' => "database",
6666
'session.lifetime' => "15",
67-
'network.name' => "joomla",
68-
'selenium.no' => "1",
69-
'selenium.version' => "latest",
70-
'extension.path' => "../../../weblinks/"
67+
'network.name' => "joomla",
68+
'selenium.no' => "1",
69+
'selenium.version' => "latest",
70+
'extension.path' => "../../../weblinks/"
7171
];
7272

7373
/**
7474
* ServerConfig constructor.
7575
*/
76-
public function __construct() {}
76+
public function __construct()
77+
{
78+
}
7779

7880
/**
7981
* @param $filename string $filename The path to the configuration file.
@@ -110,15 +112,15 @@ public function loadFromConfig($config, $path)
110112
/**
111113
* Read the configuration
112114
*
113-
* @param string $filename The path to the configuration file.
115+
* @param string $filename The path to the configuration file.
114116
*
115117
* @return string[]
116118
*/
117119
private function read($filename)
118120
{
119121
$config = [];
120122

121-
$xml = simplexml_load_file($filename);
123+
$xml = simplexml_load_string(file_get_contents($filename));
122124

123125
foreach ($xml->attributes() as $key => $attribute)
124126
{
@@ -159,7 +161,7 @@ public function getDomain()
159161
/**
160162
* Get a configuration value
161163
*
162-
* @param string $key The key
164+
* @param string $key The key
163165
*
164166
* @return string The value
165167
*/

src/Service/AbstractService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function addService(Service $service)
6666
public function getSetup()
6767
{
6868
$setup = [];
69-
foreach ($this->services as $service)
69+
foreach ((array) $this->services as $service)
7070
{
7171
$setup = array_merge($setup, $service->getSetup());
7272
}
@@ -81,7 +81,7 @@ public function getSetup()
8181
*/
8282
public function prepare()
8383
{
84-
foreach ($this->services as $service)
84+
foreach ((array) $this->services as $service)
8585
{
8686
$service->prepare();
8787
}

src/Service/Apache.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function getSetup()
2727
{
2828
$config = $this->configs[0];
2929

30-
$name = 'apache-' . $this->version . '-' . $config->getVersion('joomla');
30+
$name = 'apache-' . $this->version;
3131
$dockerPath = $this->dockyard . '/docker/' . $name;
3232
$this->setup[$name] = [
3333
'build' => 'docker/' . $name,
@@ -65,8 +65,7 @@ public function getSetup()
6565
*/
6666
public function prepare()
6767
{
68-
$dockerPath = $this->dockyard . '/docker/apache-' . $this->version . "-" .
69-
$this->configs[0]->getVersion('joomla');
68+
$dockerPath = $this->dockyard . '/docker/apache-' . $this->version;
7069

7170
$this->createDockerfile($dockerPath, __DIR__ . '/docker/apache');
7271
$this->createVhosts($dockerPath);

src/Service/Joomla.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ protected function getDockerPath($config)
275275
{
276276
$path = $config->get('host.dockyard') . '/docker';
277277
$server = $config->get('server.type');
278-
$version = $server == 'apache' ? $config->getVersion('php') . '-' . $config->getVersion('joomla') : $config->getVersion('server');
278+
$version = $server === 'apache' ? $config->getVersion('php') : $config->getVersion('server');
279279

280280
return "$path/$server-$version";
281281
}

tests-container/bootstrap.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
require_once 'vendor/autoload.php';

tests/Service/ApacheTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function testServiceSetupIsGeneratedAsAnArraySuitableForDockerCompose()
4242
'environment' => [
4343
'VIRTUAL_HOST' => 'j25-mysqli.dev',
4444
],
45+
'networks' => [
46+
'joomla',
47+
],
4548
],
4649
];
4750

tests/Service/MySqlTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public function testServiceSetupIsGeneratedAsAnArraySuitableForDockerCompose()
4040
'MYSQL_USER' => 'sqladmin',
4141
'MYSQL_PASSWORD' => 'sqladmin',
4242
],
43+
'networks' => [
44+
'joomla',
45+
],
4346
],
4447
];
4548

tests/Service/PostgreSqlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testFilesystemIsSetUp()
5252
$this->service->prepare();
5353

5454
$this->assertFileContains(
55-
'dockyard/postgresql-latest/joomla3.sql',
55+
'dockyard/postgresql-latest/00-joomla3.sql',
5656
[
5757
'CREATE DATABASE "joomla3" OWNER "sqladmin"',
5858
]

tests/fixtures_parallel_testing/j38dev-54.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)