diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index d44e2301163..e1a32171077 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -15,6 +15,12 @@ require __DIR__ . '/../../vendor/autoload.php'; trait Provisioning { use BasicStructure; + /** @var array */ + private $appsToEnableAfterScenario = []; + + /** @var array */ + private $appsToDisableAfterScenario = []; + /** @var array */ private $createdUsers = []; @@ -27,6 +33,19 @@ trait Provisioning { /** @var array */ private $createdGroups = []; + /** @AfterScenario */ + public function restoreAppsEnabledStateAfterScenario() { + $this->asAn('admin'); + + foreach ($this->appsToEnableAfterScenario as $app) { + $this->sendingTo('POST', '/cloud/apps/' . $app); + } + + foreach ($this->appsToDisableAfterScenario as $app) { + $this->sendingTo('DELETE', '/cloud/apps/' . $app); + } + } + /** * @Given /^user "([^"]*)" exists$/ * @param string $user @@ -802,6 +821,21 @@ trait Provisioning { return $extractedElementsArray; } + /** + * @Given /^app "([^"]*)" enabled state will be restored once the scenario finishes$/ + * @param string $app + */ + public function appEnabledStateWillBeRestoredOnceTheScenarioFinishes($app) { + if (in_array($app, $this->getAppsWithFilter('enabled'))) { + $this->appsToEnableAfterScenario[] = $app; + } elseif (in_array($app, $this->getAppsWithFilter('disabled'))) { + $this->appsToDisableAfterScenario[] = $app; + } + + // Apps that were not installed before the scenario will not be + // disabled nor uninstalled after the scenario. + } + private function getAppsWithFilter($filter) { $fullUrl = $this->baseUrl . 'v2.php/cloud/apps?filter=' . $filter; $client = new Client(); diff --git a/build/integration/sharees_features/sharees.feature b/build/integration/sharees_features/sharees.feature index b589673a39c..438be13becd 100644 --- a/build/integration/sharees_features/sharees.feature +++ b/build/integration/sharees_features/sharees.feature @@ -362,6 +362,26 @@ Feature: sharees | sharee2@unknown.com | 4 | sharee2@unknown.com | And "emails" sharees returned is empty + Scenario: Search e-mail when sharebymail app is disabled + Given app "sharebymail" enabled state will be restored once the scenario finishes + And sending "DELETE" to "/cloud/apps/sharebymail" + And app "sharebymail" is disabled + And As an "test" + When getting sharees for + | search | sharee2@unknown.com | + | itemType | file | + | shareType | 4 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And "exact users" sharees returned is empty + And "users" sharees returned is empty + And "exact groups" sharees returned is empty + And "groups" sharees returned is empty + And "exact remotes" sharees returned is empty + And "remotes" sharees returned is empty + And "exact emails" sharees returned is empty + And "emails" sharees returned is empty + Scenario: Search e-mail matching system e-mail address of user Given As an "test" When getting sharees for @@ -460,6 +480,27 @@ Feature: sharees And "exact emails" sharees returned is empty And "emails" sharees returned is empty + Scenario: Search user and e-mail matching system e-mail address of user when sharebymail app is disabled + Given app "sharebymail" enabled state will be restored once the scenario finishes + And sending "DELETE" to "/cloud/apps/sharebymail" + And app "sharebymail" is disabled + And As an "test" + When getting sharees for + | search | sharee2@system.com | + | itemType | file | + | shareTypes | 0 4 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And "exact users" sharees returned are + | Sharee2 | 0 | Sharee2 | sharee2@system.com | + And "users" sharees returned is empty + And "exact groups" sharees returned is empty + And "groups" sharees returned is empty + And "exact remotes" sharees returned is empty + And "remotes" sharees returned is empty + And "exact emails" sharees returned is empty + And "emails" sharees returned is empty + Scenario: Search user and e-mail matching secondary e-mail address of user Given As an "test" When getting sharees for @@ -477,3 +518,23 @@ Feature: sharees And "remotes" sharees returned is empty And "exact emails" sharees returned is empty And "emails" sharees returned is empty + + Scenario: Search user and e-mail matching secondary e-mail address of user when sharebymail app is disabled + Given app "sharebymail" enabled state will be restored once the scenario finishes + And sending "DELETE" to "/cloud/apps/sharebymail" + And app "sharebymail" is disabled + And As an "test" + When getting sharees for + | search | sharee2@secondary.com | + | itemType | file | + | shareTypes | 0 4 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And "exact users" sharees returned is empty + And "users" sharees returned is empty + And "exact groups" sharees returned is empty + And "groups" sharees returned is empty + And "exact remotes" sharees returned is empty + And "remotes" sharees returned is empty + And "exact emails" sharees returned is empty + And "emails" sharees returned is empty