From 701bf24335cca0524a61d28af6d96f20533fff59 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 6 Sep 2017 17:05:54 +0545 Subject: [PATCH 1/2] Fix integration tests findLines strpos check --- .../integration/features/bootstrap/CommandLine.php | 12 ++++++------ .../features/transfer-ownership.feature | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/integration/features/bootstrap/CommandLine.php b/tests/integration/features/bootstrap/CommandLine.php index d10316e1e6d6..2909f7358b24 100644 --- a/tests/integration/features/bootstrap/CommandLine.php +++ b/tests/integration/features/bootstrap/CommandLine.php @@ -32,7 +32,8 @@ trait CommandLine { /** * Invokes an OCC command * - * @param string OCC command, the part behind "occ". For example: "files:transfer-ownership" + * @param array $args of the occ command + * @param bool $escaping * @return int exit code */ public function runOcc($args = [], $escaping = true) { @@ -70,7 +71,7 @@ public function invokingTheCommand($cmd) { public function findExceptions() { $exceptions = []; $captureNext = false; - // the exception text usually appears after an "[Exception"] row + // the exception text usually appears after an "[Exception]" row foreach (explode("\n", $this->lastStdErr) as $line) { if (preg_match('/\[Exception\]/', $line)) { $captureNext = true; @@ -94,9 +95,8 @@ public function findExceptions() { */ 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) { + if (strpos($line, $text) !== false) { $results[] = $line; } } @@ -150,7 +150,7 @@ public function theCommandFailedWithException($exceptionText) { 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 . '"'); + throw new \Exception('The command did not output the expected text on stdout "' . $text . '"'); } } @@ -160,7 +160,7 @@ public function theCommandOutputContainsTheText($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 . '"'); + throw new \Exception('The command did not output the expected text on stderr "' . $text . '"'); } } } diff --git a/tests/integration/features/transfer-ownership.feature b/tests/integration/features/transfer-ownership.feature index f99a2cd400bf..264e749c545d 100644 --- a/tests/integration/features/transfer-ownership.feature +++ b/tests/integration/features/transfer-ownership.feature @@ -130,13 +130,13 @@ Feature: transfer-ownership Scenario: transfering ownership fails with invalid source user Given user "user0" exists When transfering 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: transfering ownership fails with invalid target user + Scenario: transfering ownership fails with invalid destination user Given user "user0" exists When transfering 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" And the command failed with exit code 1 @no_default_encryption @@ -236,19 +236,19 @@ Feature: transfer-ownership Given user "user0" exists And User "user0" created a folder "/sub" When transfering 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: transfering ownership fails with invalid target user + Scenario: transfering ownership fails with invalid destination user Given user "user0" exists And User "user0" created a folder "/sub" When transfering 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" And the command failed with exit code 1 Scenario: transfering ownership fails with invalid path Given user "user0" exists And user "user1" exists When transfering 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" And the command failed with exit code 1 From 81ce78a6a6a6c90ad18dd9a2b558a09bda64406e Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 6 Sep 2017 20:24:27 +0545 Subject: [PATCH 2/2] Typo of transferring --- .../features/bootstrap/CommandLineContext.php | 8 +- .../features/transfer-ownership.feature | 88 +++++++++---------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/integration/features/bootstrap/CommandLineContext.php b/tests/integration/features/bootstrap/CommandLineContext.php index 03b37fe67d1a..61fe967ef453 100644 --- a/tests/integration/features/bootstrap/CommandLineContext.php +++ b/tests/integration/features/bootstrap/CommandLineContext.php @@ -77,9 +77,9 @@ private function findLastTransferFolderForUser($sourceUser, $targetUser) { } /** - * @When /^transfering ownership from "([^"]+)" to "([^"]+)"/ + * @When /^transferring ownership from "([^"]+)" to "([^"]+)"/ */ - public function transferingOwnership($user1, $user2) { + public function transferringOwnership($user1, $user2) { if ($this->runOcc(['files:transfer-ownership', $user1, $user2]) === 0) { $this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2); } else { @@ -89,9 +89,9 @@ public function transferingOwnership($user1, $user2) { } /** - * @When /^transfering ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"/ + * @When /^transferring ownership of path "([^"]+)" from "([^"]+)" to "([^"]+)"/ */ - public function transferingOwnershipPath($path, $user1, $user2) { + public function transferringOwnershipPath($path, $user1, $user2) { $path = '--path=' . $path; if($this->runOcc(['files:transfer-ownership', $path, $user1, $user2]) === 0) { $this->lastTransferPath = $this->findLastTransferFolderForUser($user1, $user2); diff --git a/tests/integration/features/transfer-ownership.feature b/tests/integration/features/transfer-ownership.feature index 264e749c545d..722d68fa8810 100644 --- a/tests/integration/features/transfer-ownership.feature +++ b/tests/integration/features/transfer-ownership.feature @@ -1,75 +1,75 @@ Feature: transfer-ownership @no_default_encryption - Scenario: transfering ownership of a file + Scenario: transferring ownership of a file Given user "user0" exists And user "user1" exists And User "user0" uploads file "data/textfile.txt" to "/somefile.txt" - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then Downloaded content when downloading file "/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of a file after updating the file + Scenario: transferring ownership of a file after updating the file Given user "user0" exists And user "user1" exists And User "user0" uploads file "data/file_to_overwrite.txt" to "/PARENT/textfile0.txt" And user "user0" uploads chunk file "1" of "3" with "AA" to "/PARENT/textfile0.txt" And user "user0" uploads chunk file "2" of "3" with "BB" to "/PARENT/textfile0.txt" And user "user0" uploads chunk file "3" of "3" with "CC" to "/PARENT/textfile0.txt" - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" Then the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then Downloaded content when downloading file "/PARENT/textfile0.txt" with range "bytes=0-5" should be "AABBCC" @no_default_encryption - Scenario: transfering ownership of a folder + Scenario: transferring ownership of a folder Given user "user0" exists And user "user1" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of file shares + Scenario: transferring ownership of file shares Given user "user0" exists And user "user1" exists And user "user2" exists And User "user0" uploads file "data/textfile.txt" to "/somefile.txt" And file "/somefile.txt" of user "user0" is shared with user "user2" with permissions 19 - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder shared with third user + Scenario: transferring ownership of folder shared with third user Given user "user0" exists And user "user1" exists And user "user2" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user2" with permissions 31 - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder shared with transfer recipient + Scenario: transferring ownership of folder shared with transfer recipient Given user "user0" exists And user "user1" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user1" with permissions 31 - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user1" Then as "user1" the folder "/test" does not exist @@ -77,7 +77,7 @@ Feature: transfer-ownership And Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder doubly shared with third user + Scenario: transferring ownership of folder doubly shared with third user Given group "group1" exists And user "user0" exists And user "user1" exists @@ -87,36 +87,36 @@ Feature: transfer-ownership And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with group "group1" with permissions 31 And folder "/test" of user "user0" is shared with user "user2" with permissions 31 - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership does not transfer received shares + Scenario: transferring ownership does not transfer received shares Given user "user0" exists And user "user1" exists And user "user2" exists And User "user2" created a folder "/test" And folder "/test" of user "user2" is shared with user "user0" with permissions 31 - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then as "user1" the folder "/test" does not exist @local_storage @no_default_encryption - Scenario: transfering ownership does not transfer external storage + Scenario: transferring ownership does not transfer external storage Given user "user0" exists And user "user1" exists - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then as "user1" the folder "/local_storage" does not exist @no_default_encryption - Scenario: transfering ownership does not fail with shared trashed files + Scenario: transferring ownership does not fail with shared trashed files Given user "user0" exists And user "user1" exists And user "user2" exists @@ -124,67 +124,67 @@ Feature: transfer-ownership And User "user0" created a folder "/sub/test" And folder "/sub/test" of user "user0" is shared with user "user2" with permissions 31 And User "user0" deletes folder "/sub" - When transfering ownership from "user0" to "user1" + When transferring ownership from "user0" to "user1" Then the command was successful - Scenario: transfering ownership fails with invalid source user + Scenario: transferring ownership fails with invalid source user Given user "user0" exists - When transfering ownership from "invalid_user" to "user0" + When transferring ownership from "invalid_user" to "user0" Then the command output contains the text "Unknown source user" And the command failed with exit code 1 - Scenario: transfering ownership fails with invalid destination user + Scenario: transferring ownership fails with invalid destination user Given user "user0" exists - When transfering ownership from "user0" to "invalid_user" + When transferring ownership from "user0" to "invalid_user" Then the command output contains the text "Unknown destination user" And the command failed with exit code 1 @no_default_encryption - Scenario: transfering ownership of a folder + Scenario: transferring ownership of a folder Given user "user0" exists And user "user1" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of file shares + Scenario: transferring ownership of file shares Given user "user0" exists And user "user1" exists And user "user2" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And file "/test/somefile.txt" of user "user0" is shared with user "user2" with permissions 19 - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder shared with third user + Scenario: transferring ownership of folder shared with third user Given user "user0" exists And user "user1" exists And user "user2" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user2" with permissions 31 - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder shared with transfer recipient + Scenario: transferring ownership of folder shared with transfer recipient Given user "user0" exists And user "user1" exists And User "user0" created a folder "/test" And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with user "user1" with permissions 31 - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" And the command was successful And As an "user1" Then as "user1" the folder "/test" does not exist @@ -192,7 +192,7 @@ Feature: transfer-ownership And Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" @no_default_encryption - Scenario: transfering ownership of folder doubly shared with third user + Scenario: transferring ownership of folder doubly shared with third user Given group "group1" exists And user "user0" exists And user "user1" exists @@ -202,12 +202,12 @@ Feature: transfer-ownership And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt" And folder "/test" of user "user0" is shared with group "group1" with permissions 31 And folder "/test" of user "user0" is shared with user "user2" with permissions 31 - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" And the command was successful And As an "user2" Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is" - Scenario: transfering ownership does not transfer received shares + Scenario: transferring ownership does not transfer received shares Given user "user0" exists And user "user1" exists And user "user2" exists @@ -215,40 +215,40 @@ Feature: transfer-ownership And User "user0" created a folder "/sub" And folder "/test" of user "user2" is shared with user "user0" with permissions 31 And User "user0" moved folder "/test" to "/sub/test" - When transfering ownership of path "sub" from "user0" to "user1" + When transferring ownership of path "sub" from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then as "user1" the folder "/sub/test" does not exist @local_storage - Scenario: transfering ownership does not transfer external storage + Scenario: transferring ownership does not transfer external storage Given user "user0" exists And user "user1" exists And User "user0" created a folder "/sub" - When transfering ownership of path "sub" from "user0" to "user1" + When transferring ownership of path "sub" from "user0" to "user1" And the command was successful And As an "user1" And using received transfer folder of "user1" as dav path Then as "user1" the folder "/local_storage" does not exist - Scenario: transfering ownership fails with invalid source user + Scenario: transferring ownership fails with invalid source user Given user "user0" exists And User "user0" created a folder "/sub" - When transfering ownership of path "sub" from "invalid_user" to "user0" + When transferring ownership of path "sub" from "invalid_user" to "user0" Then the command output contains the text "Unknown source user" And the command failed with exit code 1 - Scenario: transfering ownership fails with invalid destination user + Scenario: transferring ownership fails with invalid destination user Given user "user0" exists And User "user0" created a folder "/sub" - When transfering ownership of path "sub" from "user0" to "invalid_user" + When transferring ownership of path "sub" from "user0" to "invalid_user" Then the command output contains the text "Unknown destination user" And the command failed with exit code 1 - Scenario: transfering ownership fails with invalid path + Scenario: transferring ownership fails with invalid path Given user "user0" exists And user "user1" exists - When transfering ownership of path "test" from "user0" to "user1" + When transferring ownership of path "test" from "user0" to "user1" Then the command output contains the text "Unknown path provided" And the command failed with exit code 1