Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10750749
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/traits/assertHttp.php b/traits/assertHttp.php
index 11a5087..3b9376b 100644
--- a/traits/assertHttp.php
+++ b/traits/assertHttp.php
@@ -1,31 +1,30 @@
<?php
trait assertHttp {
/**
* Asserts the HTTP response code of an URL matches the expected code
*
* @param int $expectedCode the expected HTTP response code
* @param string $url the URL to check
* @param string $comment the comment to output if the test fails [facultative]
*/
- private function assertHttpResponseCode ($expectedCode, $url, $comment = '') {
+ private function assertHttpResponseCode ($expectedCode, $url, $comment = '') : void {
$actualCode = $this->getHttpResponseCode($url);
- return $this->assertEquals($expectedCode, $actualCode, $comment);
+ $this->assertEquals($expectedCode, $actualCode, $comment);
}
/**
* Gets the HTTP response code of the specified URL
*
* @param string $url
- * @return int the HTTP response code
*/
- private function getHttpResponseCode ($url) {
+ private function getHttpResponseCode ($url) : int {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, "Nasqueron-Ops-Tests");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $code;
}
}
diff --git a/utils/DockerContainer.php b/utils/DockerContainer.php
index 9f0d3da..8ccc1e4 100644
--- a/utils/DockerContainer.php
+++ b/utils/DockerContainer.php
@@ -1,54 +1,50 @@
<?php
class DockerContainer {
private $host;
private $container;
/**
* Initializes a new instance of the DockerContainer class
*
* @param string $host hostname
* @param string $container container name
*/
public function __construct ($host, $container) {
if (!self::isValidHostname($host)) {
throw new ArgumentException("Invalid hostname.");
}
if (!self::isValidContainerName($container)) {
throw new ArgumentException("Invalid container name.");
}
$this->host = $host;
$this->container = $container;
}
/**
* Determines if a hostname is valid
- *
- * @return bool true if the specified name is valid; otherwise, false
*/
- public static function isValidHostname ($host) {
+ public static function isValidHostname ($host) : bool {
return (bool)preg_match('/^[A-Za-z0-9\-\.]+$/', $host);
}
/**
* Determines if a container name is valid
- *
- * @return bool true if the specified name is valid; otherwise, false
*/
- public static function isValidContainerName ($name) {
+ public static function isValidContainerName ($name) : bool {
//Source: https://github.com/ajhager/docker/commit/f63cdf0260cf6287d28a589a79d3f947def6a569
return (bool)preg_match('@^/?[a-zA-Z0-9_-]+$@', $name);
}
/**
* Executes the specified command in the container
*
* @param string $command the command to run
* @return string the command output
*/
- public function exec ($command) {
+ public function exec ($command) : string {
$output = `ssh $this->host docker exec $this->container $command`;
return trim($output);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jul 27, 20:35 (10 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2847587
Default Alt Text
(3 KB)
Attached To
Mode
rTESTSPRODENV Test suite for operations: prod-environment-behaves-correctly
Attached
Detach File
Event Timeline
Log In to Comment