summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-27 10:35:18 +0100
committerGitHub <noreply@github.com>2020-10-27 10:35:18 +0100
commitd38a7c6710227a17a6bbd2a3e423668c202b57c3 (patch)
tree01f57c87a22c8c9d935ae577e1cf99ba7585ad7e
parent4419d3e4de0bec7f628415f1f672869c9a385330 (diff)
parent92be66cff242089037368c1af3370a613004b4a7 (diff)
downloadnextcloud-server-d38a7c6710227a17a6bbd2a3e423668c202b57c3.tar.gz
nextcloud-server-d38a7c6710227a17a6bbd2a3e423668c202b57c3.zip
Merge pull request #23697 from nextcloud/bugfix/noid/fix-undefined-variable
Fix undefined variable
-rw-r--r--build/integration/features/bootstrap/CommandLine.php31
-rw-r--r--build/integration/features/transfer-ownership.feature12
2 files changed, 10 insertions, 33 deletions
diff --git a/build/integration/features/bootstrap/CommandLine.php b/build/integration/features/bootstrap/CommandLine.php
index 060e2b5be26..b34005fdadf 100644
--- a/build/integration/features/bootstrap/CommandLine.php
+++ b/build/integration/features/bootstrap/CommandLine.php
@@ -23,6 +23,8 @@
*
*/
+use PHPUnit\Framework\Assert;
+
require __DIR__ . '/../../vendor/autoload.php';
trait CommandLine {
@@ -96,25 +98,6 @@ trait CommandLine {
}
/**
- * Finds all lines containing the given text
- *
- * @param string $input stdout or stderr output
- * @param string $text text to search for
- * @return array array of lines that matched
- */
- public function findLines($input, $text) {
- $results = [];
- // the exception text usually appears after an "[Exception"] row
- foreach (explode("\n", $input) as $line) {
- if (strpos($line, $text) >= 0) {
- $results[] = $line;
- }
- }
-
- return $results;
- }
-
- /**
* @Then /^the command was successful$/
*/
public function theCommandWasSuccessful() {
@@ -158,19 +141,13 @@ trait CommandLine {
* @Then /^the command output contains the text "([^"]*)"$/
*/
public function theCommandOutputContainsTheText($text) {
- $lines = $this->findLines($this->lastStdOut, $text);
- if (empty($lines)) {
- throw new \Exception('The command did not output the expected text on stdout "' . $exceptionText . '"');
- }
+ Assert::assertContains($text, $this->lastStdOut, 'The command did not output the expected text on stdout');
}
/**
* @Then /^the command error output contains the text "([^"]*)"$/
*/
public function theCommandErrorOutputContainsTheText($text) {
- $lines = $this->findLines($this->lastStdErr, $text);
- if (empty($lines)) {
- throw new \Exception('The command did not output the expected text on stderr "' . $exceptionText . '"');
- }
+ Assert::assertContains($text, $this->lastStdErr, 'The command did not output the expected text on stderr');
}
}
diff --git a/build/integration/features/transfer-ownership.feature b/build/integration/features/transfer-ownership.feature
index d8dd4d5c09d..b18453cf3ec 100644
--- a/build/integration/features/transfer-ownership.feature
+++ b/build/integration/features/transfer-ownership.feature
@@ -297,13 +297,13 @@ Feature: transfer-ownership
Scenario: transferring ownership fails with invalid source user
Given user "user0" exists
When transferring ownership from "invalid_user" to "user0"
- Then the command error output contains the text "Unknown source user"
+ Then the command output contains the text "Unknown source user"
And the command failed with exit code 1
Scenario: transferring ownership fails with invalid target user
Given user "user0" exists
When transferring ownership from "user0" to "invalid_user"
- Then the command error output contains the text "Unknown target user"
+ Then the command output contains the text "Unknown destination user invalid_user"
And the command failed with exit code 1
Scenario: transferring ownership of a file
@@ -511,7 +511,7 @@ Feature: transfer-ownership
And user "user2" accepts last share
When transferring ownership of path "test" from "user0" to "user1"
Then the command failed with exit code 1
- And the command error output contains the text "Could not transfer files."
+ And the command output contains the text "Could not transfer files."
Scenario: transferring ownership does not transfer received shares
Given user "user0" exists
@@ -547,19 +547,19 @@ Feature: transfer-ownership
Given user "user0" exists
And User "user0" created a folder "/sub"
When transferring ownership of path "sub" from "invalid_user" to "user0"
- Then the command error output contains the text "Unknown source user"
+ Then the command output contains the text "Unknown source user"
And the command failed with exit code 1
Scenario: transferring ownership fails with invalid target user
Given user "user0" exists
And User "user0" created a folder "/sub"
When transferring ownership of path "sub" from "user0" to "invalid_user"
- Then the command error output contains the text "Unknown target user"
+ Then the command output contains the text "Unknown destination user invalid_user"
And the command failed with exit code 1
Scenario: transferring ownership fails with invalid path
Given user "user0" exists
And user "user1" exists
When transferring ownership of path "test" from "user0" to "user1"
- Then the command error output contains the text "Unknown target user"
+ Then the command output contains the text "Unknown path provided: test"
And the command failed with exit code 1