diff --git a/build/acceptance/features/core/NextcloudTestServerDockerHelper.php b/build/acceptance/features/core/NextcloudTestServerDockerHelper.php index 71c7f9ad850..69dafc2276b 100644 --- a/build/acceptance/features/core/NextcloudTestServerDockerHelper.php +++ b/build/acceptance/features/core/NextcloudTestServerDockerHelper.php @@ -191,6 +191,21 @@ class NextcloudTestServerDockerHelper { $this->executeDockerCommand("rm --volumes --force " . $this->containerName); } + /** + * Returns whether the container exists (no matter its state) or not. + * + * @return boolean true if the container exists, false otherwise. + * @throws \Exception if the Docker command failed to execute. + */ + private function isContainerRegistered() { + // With the "--quiet" option "docker ps" only shows the ID of the + // matching containers, without table headers. Therefore, if the + // container does not exist the output will be empty (not even a new + // line, as the last line of output returned by "executeDockerCommand" + // does not include a trailing new line character). + return $this->executeDockerCommand("ps --all --quiet --filter 'name=" . $this->containerName . "'") !== ""; + } + /** * Returns the base URL of the Nextcloud test server. * @@ -214,21 +229,6 @@ class NextcloudTestServerDockerHelper { return $this->executeDockerCommand("port " . $this->containerName . " 80"); } - /** - * Returns whether the container exists (no matter its state) or not. - * - * @return boolean true if the container exists, false otherwise. - * @throws \Exception if the Docker command failed to execute. - */ - private function isContainerRegistered() { - // With the "--quiet" option "docker ps" only shows the ID of the - // matching containers, without table headers. Therefore, if the - // container does not exist the output will be empty (not even a new - // line, as the last line of output returned by "executeDockerCommand" - // does not include a trailing new line character). - return $this->executeDockerCommand("ps --all --quiet --filter 'name=" . $this->containerName . "'") !== ""; - } - /** * Executes the given Docker command. *