Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 78 additions & 12 deletions tests/acceptance/features/apiMain/appmanagement.feature
Original file line number Diff line number Diff line change
@@ -1,33 +1,99 @@
@api
Feature: AppManagement

Background:
Given apps have been put in two directories "apps" and "apps2"
Scenario: Two apps_path exist by default. The first one is more recent
Given app "multidirtest" with version "1.0.2" has been put in dir "apps"
And app "multidirtest" with version "1.0.1" has been put in dir "apps-external"
When the administrator gets the path for app "multidirtest" using the occ command
Then the path to "multidirtest" should be "apps"

Scenario: Two apps_path exist by default. The second one is more recent
Given app "multidirtest" with version "1.0.2" has been put in dir "apps"
And app "multidirtest" with version "1.0.10" has been put in dir "apps-external"
When the administrator gets the path for app "multidirtest" using the occ command
Then the path to "multidirtest" should be "apps-external"

Scenario: Two app instances exist the first is more recent
Given app "multidirtest" with version "1.0.1" has been put in dir "apps"
And app "multidirtest" with version "1.0.0" has been put in dir "apps2"
Scenario: Three app instances, including apps-external, exist. The first one is more recent
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "multidirtest" with version "1.0.2" has been put in dir "apps"
And app "multidirtest" with version "1.0.1" has been put in dir "apps-external"
And app "multidirtest" with version "1.0.0" has been put in dir "apps-custom"
When the administrator gets the path for app "multidirtest" using the occ command
Then the path to "multidirtest" should be "apps"

Scenario: Two app instances exist the second is more recent
Given app "multidirtest" with version "1.0.0" has been put in dir "apps"
And app "multidirtest" with version "1.0.5" has been put in dir "apps2"
Scenario: Three app instances, including apps-external, exist. The second one is more recent
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "multidirtest" with version "1.0.2" has been put in dir "apps"
And app "multidirtest" with version "1.0.10" has been put in dir "apps-external"
And app "multidirtest" with version "1.0.0" has been put in dir "apps-custom"
When the administrator gets the path for app "multidirtest" using the occ command
Then the path to "multidirtest" should be "apps-external"

Scenario: Three app instances, including apps-external, exist. The third one is more recent
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "multidirtest" with version "1.0.2" has been put in dir "apps"
And app "multidirtest" with version "1.0.1" has been put in dir "apps-external"
And app "multidirtest" with version "1.0.10" has been put in dir "apps-custom"
When the administrator gets the path for app "multidirtest" using the occ command
Then the path to "multidirtest" should be "apps2"
Then the path to "multidirtest" should be "apps-custom"

Scenario: Update of patch version of an app
Given app "updatetest" with version "2.0.0" has been put in dir "apps"
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "updatetest" with version "2.0.0" has been put in dir "apps"
And app "updatetest" has been enabled
And app "updatetest" has been disabled
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps"
And the administrator enables app "updatetest"
Then the installed version of "updatetest" should be "2.0.1"

Scenario: Update of patch version of an app in apps-external, previous version in apps folder
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "updatetest" with version "2.0.0" has been put in dir "apps"
And app "updatetest" has been enabled
And app "updatetest" has been disabled
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps-external"
And the administrator enables app "updatetest"
Then the installed version of "updatetest" should be "2.0.1"

Scenario: Update of patch version of an app in apps-external
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "updatetest" with version "2.0.0" has been put in dir "apps-external"
And app "updatetest" has been enabled
And app "updatetest" has been disabled
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps-external"
And the administrator enables app "updatetest"
Then the installed version of "updatetest" should be "2.0.1"

Scenario: Update of patch version of an app but update is put in alternative folder
Given app "updatetest" with version "2.0.0" has been put in dir "apps"
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "updatetest" with version "2.0.0" has been put in dir "apps"
And app "updatetest" has been enabled
And app "updatetest" has been disabled
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps-custom"
And the administrator enables app "updatetest"
Then the installed version of "updatetest" should be "2.0.1"

Scenario: Update of patch version of an app previously in apps-external but update is put in alternative folder
Given these apps' path has been configured additionally with following attributes:
| dir | is_writable |
| apps-custom | true |
And app "updatetest" with version "2.0.0" has been put in dir "apps-external"
And app "updatetest" has been enabled
And app "updatetest" has been disabled
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps2"
When the administrator puts app "updatetest" with version "2.0.1" in dir "apps-custom"
And the administrator enables app "updatetest"
Then the installed version of "updatetest" should be "2.0.1"
32 changes: 17 additions & 15 deletions tests/acceptance/features/bootstrap/AppManagementContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

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

require __DIR__ . '/../../../../lib/composer/autoload.php';
Expand Down Expand Up @@ -64,26 +64,28 @@ public function setAppsPaths($appsPaths) {
}

/**
* @Given apps have been put in two directories :dir1 and :dir2
* @Given these apps' path has been configured additionally with following attributes:
*
* @param string $dir1
* @param string $dir2
* @param TableNode $table
*
* @return void
* @throws Exception
*/
public function setAppDirectories($dir1, $dir2) {
$fullpath1 = $this->featureContext->getServerRoot() . "/$dir1";
$fullpath2 = $this->featureContext->getServerRoot() . "/$dir2";

$this->featureContext->mkDirOnServer($dir1);
$this->featureContext->mkDirOnServer($dir2);
$this->setAppsPaths(
[
['path' => $fullpath1, 'url' => $dir1, 'writable' => true],
['path' => $fullpath2, 'url' => $dir2, 'writable' => true]
]
public function setAppDirectories(TableNode $table) {
$appsPathsConfigs = \json_decode(
$this->featureContext->getSystemConfig("apps_paths", "json")['stdOut'],
true
);
foreach ($table as $appsPathToAdd) {
$dir = $appsPathToAdd['dir'];
$appsPathsConfigs[] = [
'url' => $dir,
'path' => $this->featureContext->getServerRoot() . "/$dir",
'writable' => $appsPathToAdd['is_writable'] === 'true',
];
$this->featureContext->mkDirOnServer($appsPathToAdd['dir']);
}
$this->setAppsPaths($appsPathsConfigs);
}

/**
Expand Down