Page MenuHomeDevCentral

D2588.diff
No OneTemporary

D2588.diff

diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
"description": "Tests to validate production environment",
"type": "project",
"require": {
- "phpunit/phpunit": "^7.3",
+ "phpunit/phpunit": "^9.5",
"ext-yaml": "*"
},
"license": "BSD-2-Clause",
@@ -12,5 +12,11 @@
"name": "Sébastien Santoro",
"email": "dereckson@espace-win.org"
}
- ]
+ ],
+ "autoload": {
+ "psr-4": {
+ "Nasqueron\\Infrastructure\\ProductionTests\\": "tests/",
+ "Nasqueron\\Infrastructure\\": "lib/Infrastructure"
+ }
+ }
}
diff --git a/utils/DockerContainer.php b/lib/Infrastructure/DockerContainer.php
rename from utils/DockerContainer.php
rename to lib/Infrastructure/DockerContainer.php
--- a/utils/DockerContainer.php
+++ b/lib/Infrastructure/DockerContainer.php
@@ -1,5 +1,7 @@
<?php
+namespace Nasqueron\Infrastructure;
+
class DockerContainer {
private $host;
private $container;
diff --git a/utils/OperationsConfiguration.php b/lib/Infrastructure/OperationsConfiguration.php
rename from utils/OperationsConfiguration.php
rename to lib/Infrastructure/OperationsConfiguration.php
diff --git a/phpunit.xml b/phpunit.xml
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,10 +1,11 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.3/phpunit.xsd"
+ bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Main">
- <directory>.</directory>
+ <directory>tests</directory>
<exclude>vendor</exclude>
</testsuite>
</testsuites>
diff --git a/ApiServersLogTest.php b/tests/ApiServersLogTest.php
rename from ApiServersLogTest.php
rename to tests/ApiServersLogTest.php
--- a/ApiServersLogTest.php
+++ b/tests/ApiServersLogTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class ApiServersLogTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class ApiServersLogTest extends TestCase {
+ use WithAssertHttp;
public function testAlive () {
$url = 'https://api.nasqueron.org/servers-log/status';
diff --git a/AuthGroveTest.php b/tests/AuthGroveTest.php
rename from AuthGroveTest.php
rename to tests/AuthGroveTest.php
--- a/AuthGroveTest.php
+++ b/tests/AuthGroveTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class AuthGroveTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class AuthGroveTest extends TestCase {
+ use WithAssertHttp;
public function testTLS () {
$this->assertHttpResponseCode(301, 'http://login.nasqueron.org', 'Webserver should be configured to redirect http to https.');
@@ -21,7 +23,7 @@
$this->assertHttpResponseCode(302, $url, '/ should redirect to login page');
$content = file_get_contents($url);
- $this->assertContains('https://login.nasqueron.org/auth/', $content);
+ $this->assertStringContainsString('https://login.nasqueron.org/auth/', $content);
}
public function testNotExisting () {
diff --git a/DevCentralDockerTest.php b/tests/DevCentralDockerTest.php
rename from DevCentralDockerTest.php
rename to tests/DevCentralDockerTest.php
--- a/DevCentralDockerTest.php
+++ b/tests/DevCentralDockerTest.php
@@ -1,13 +1,17 @@
<?php
-require_once 'utils/DockerContainer.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class DevCentralDockerTest extends PHPUnit\Framework\TestCase {
+use PHPUnit\Framework\TestCase;
+
+use Nasqueron\Infrastructure\DockerContainer;
+
+class DevCentralDockerTest extends TestCase {
private $container;
const DOCKER_CONTAINER = 'devcentral';
- protected function setUp () {
+ public function setUp () : void {
if (!getenv('DOCKER_ACCESS')) {
$this->markTestSkipped("No access to Docker engine.");
}
@@ -35,7 +39,7 @@
];
foreach ($expectedProcesses as $expectedProcess) {
- $this->assertContains($expectedProcess, $processes, "The process $expectedProcess isn't currently launched.");
+ $this->assertStringContainsString($expectedProcess, $processes, "The process $expectedProcess isn't currently launched.");
}
}
@@ -48,7 +52,7 @@
];
foreach ($expectedDaemons as $expectedDaemon) {
- $this->assertContains($expectedDaemon, $daemons, "The daemon $expectedDaemon isn't currently launched.");
+ $this->assertStringContainsString($expectedDaemon, $daemons, "The daemon $expectedDaemon isn't currently launched.");
}
}
}
diff --git a/DevCentralTest.php b/tests/DevCentralTest.php
rename from DevCentralTest.php
rename to tests/DevCentralTest.php
--- a/DevCentralTest.php
+++ b/tests/DevCentralTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class DevCentralTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class DevCentralTest extends TestCase {
+ use WithAssertHttp;
public function testWebsiteIsUp () {
$this->assertHttpResponseCode(200, 'https://devcentral.nasqueron.org', "DevCentral HTTPS issue.");
diff --git a/EtherpadTest.php b/tests/EtherpadTest.php
rename from EtherpadTest.php
rename to tests/EtherpadTest.php
--- a/EtherpadTest.php
+++ b/tests/EtherpadTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class EtherpadTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class EtherpadTest extends TestCase {
+ use WithAssertHttp;
public function testEtherpadIsLive () {
$this->assertHttpResponseCode(301, 'http://pad.nasqueron.org/', "Etherpad isn't redirected on HTTP.");
@@ -21,6 +23,6 @@
$stringOnlyAvailableWhenApiWorks = '","'; // pads titles separator
$currentContent = file_get_contents($url);
- $this->assertContains($stringOnlyAvailableWhenApiWorks, $currentContent, "On Ysul, /home/wolfplex.org/logs/api.log could help. But more probably, you reinstalled the Etherpad container without restoring the API key. Move the former APIKEY.txt file to /opt/etherpad-lite or, if lost, update Wolfplex API credentials with the new API key.");
+ $this->assertStringContainsString($stringOnlyAvailableWhenApiWorks, $currentContent, "On Ysul, /home/wolfplex.org/logs/api.log could help. But more probably, you reinstalled the Etherpad container without restoring the API key. Move the former APIKEY.txt file to /opt/etherpad-lite or, if lost, update Wolfplex API credentials with the new API key.");
}
}
diff --git a/NotificationsTest.php b/tests/NotificationsTest.php
rename from NotificationsTest.php
rename to tests/NotificationsTest.php
--- a/NotificationsTest.php
+++ b/tests/NotificationsTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class NotificationsTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class NotificationsTest extends TestCase {
+ use WithAssertHttp;
///
/// Alive tests
diff --git a/PaaSDockerTest.php b/tests/PaaSDockerTest.php
rename from PaaSDockerTest.php
rename to tests/PaaSDockerTest.php
--- a/PaaSDockerTest.php
+++ b/tests/PaaSDockerTest.php
@@ -1,13 +1,14 @@
<?php
-require_once 'traits/assertHttp.php';
-require_once 'utils/OperationsConfiguration.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
+
+use PHPUnit\Framework\TestCase;
use Nasqueron\Infrastructure\OperationsConfiguration;
-class PaaSDockerTest extends PHPUnit\Framework\TestCase {
+class PaaSDockerTest extends TestCase {
- use assertHttp;
+ use WithAssertHttp;
/**
* @dataProvider provideDockerDomains
diff --git a/TommyTest.php b/tests/TommyTest.php
rename from TommyTest.php
rename to tests/TommyTest.php
--- a/TommyTest.php
+++ b/tests/TommyTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class TommyTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class TommyTest extends TestCase {
+ use WithAssertHttp;
/**
* @dataProvider provideTommyInstances
diff --git a/traits/assertHttp.php b/tests/WithAssertHttp.php
rename from traits/assertHttp.php
rename to tests/WithAssertHttp.php
--- a/traits/assertHttp.php
+++ b/tests/WithAssertHttp.php
@@ -1,6 +1,10 @@
<?php
-trait assertHttp {
+namespace Nasqueron\Infrastructure\ProductionTests;
+
+use PHPUnit\Framework\TestCase;
+
+trait WithAssertHttp {
/**
* Asserts the HTTP response code of an URL matches the expected code
*/
diff --git a/ZedTest.php b/tests/ZedTest.php
rename from ZedTest.php
rename to tests/ZedTest.php
--- a/ZedTest.php
+++ b/tests/ZedTest.php
@@ -1,9 +1,11 @@
<?php
-require_once 'traits/assertHttp.php';
+namespace Nasqueron\Infrastructure\ProductionTests;
-class ZedTest extends PHPUnit\Framework\TestCase {
- use assertHttp;
+use PHPUnit\Framework\TestCase;
+
+class ZedTest extends TestCase {
+ use WithAssertHttp;
public function testAlive () {
$url = 'https://hypership.space/';

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 07:37 (20 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257426
Default Alt Text
D2588.diff (9 KB)

Event Timeline