Skip to content

Commit

Permalink
Test repair step listing commands
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed May 17, 2019
1 parent 2873da5 commit 1e87953
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\TableNode;
use TestHelpers\SetupHelper;

require_once 'bootstrap.php';
Expand Down Expand Up @@ -462,6 +463,15 @@ public function theAdminAddsRemovesAsTheApplicableUserLastLocalMountUsingTheOccC
);
}

/**
* @When the administrator list the repair steps using the occ command
*
* @return void
*/
public function theAdministratorListTheRepairStepsUsingTheOccCommand() {
$this->invokingTheCommand('maintenance:repair --list');
}

/**
* @Then the background jobs mode should be :mode
*
Expand Down Expand Up @@ -600,6 +610,27 @@ public function systemConfigKeyShouldHaveValue($key, $value) {
PHPUnit\Framework\Assert::assertSame($value, $config);
}

/**
* @Then the command output table should contain the following text:
*
* @param TableNode $table table of patterns to find with table title as 'table_column'
*
* @return void
*/
public function theCommandOutputTableShouldContainTheFollowingText(TableNode $table) {
$commandOutput = $this->featureContext->getStdOutOfOccCommand();
foreach ($table as $row) {
$lines = $this->featureContext->findLines(
$commandOutput,
$row['table_column']
);
PHPUnit\Framework\Assert::assertNotEmpty(
$lines,
"Value: " . $row['table_column'] . " not found"
);
}
}

/**
* @Then system config key :key should not exist
*
Expand Down
34 changes: 34 additions & 0 deletions tests/acceptance/features/cliMain/maintenance.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@cli @local_storage @TestAlsoOnExternalUserBackend
Feature: Maintenance command

As an admin
I want to be able to maintain and repair my ownCloud installation
So that I can run ownCloud smoothly

Scenario: Repair steps should be listed correctly
When the administrator list the repair steps using the occ command
Then the command should have been successful
And the command output should contain the text "Found 16 repair steps"
And the command output table should contain the following text:
| table_column |
| OC\Repair\RepairMimeTypes |
| OC\Repair\RepairMismatchFileCachePath |
| OC\Repair\FillETags |
| OC\Repair\CleanTags |
| OC\Repair\DropOldTables |
| OC\Repair\DropOldJobs |
| OC\Repair\RemoveGetETagEntries |
| OC\Repair\RepairInvalidShares |
| OC\Repair\RepairSubShares |
| OC\Repair\SharePropagation |
| OC\Repair\MoveAvatarOutsideHome |
| OC\Repair\RemoveRootShares |
| OC\Repair\RepairUnmergedShares |
| OC\Repair\DisableExtraThemes |
| OC\Repair\OldGroupMembershipShares |
| OCA\DAV\Repair\RemoveInvalidShares |

Scenario: Running single repair step without providing value should fail
When the administrator invokes occ command "maintenance:repair --single"
Then the command should have failed with exit code 1
And the command error output should contain the text 'The "--single" option requires a value'

0 comments on commit 1e87953

Please sign in to comment.