From 9a1053fc222c52bfd30acaf86b457319d64ff86d Mon Sep 17 00:00:00 2001 From: paurakhsharma Date: Wed, 29 May 2019 13:16:07 +0545 Subject: [PATCH 1/2] move user creation without skeleton from activity app --- .../features/bootstrap/Provisioning.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 741952ece072..084b907a5080 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -271,6 +271,21 @@ public function userHasBeenCreatedWithDefaultAttributes($user) { } } + /** + * @Given /^user "([^"]*)" has been created with default attributes and without skeleton files$/ + * + * @param string $user + * + * @return void + */ + public function userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles($user) { + $this->featureContext->runOcc(["config:system:get skeletondirectory"]); + $path = \trim($this->featureContext->getStdOutOfOccCommand()); + $this->featureContext->runOcc(["config:system:delete skeletondirectory"]); + $this->featureContext->userHasBeenCreatedWithDefaultAttributes($user); + $this->featureContext->runOcc(["config:system:set skeletondirectory --value $path"]); + } + /** * @Given /^these users have been created\s?(with default attributes|)\s?(but not initialized|):$/ * expects a table of users with the heading @@ -2069,7 +2084,7 @@ public function theAdministratorGetsAllTheGroupsWhereUserIsSubadminUsingTheProvi $fullUrl, $this->getAdminUsername(), $this->getAdminPassword() ); } - + /** * @Given /^user "([^"]*)" has been made a subadmin of group "([^"]*)"$/ * @@ -2790,7 +2805,7 @@ public function cleanupGroups() { } $this->usingServer($previousServer); } - + /** * @BeforeScenario * @@ -2800,7 +2815,7 @@ public function rememberAppEnabledDisabledState() { $this->enabledApps = $this->getEnabledApps(); $this->disabledApps = $this->getDisabledApps(); } - + /** * @AfterScenario * From c611fd66ebf053516f5c60b0770462ecc00e363a Mon Sep 17 00:00:00 2001 From: paurakhsharma Date: Wed, 29 May 2019 13:45:19 +0545 Subject: [PATCH 2/2] Add error handling on user creation --- tests/acceptance/features/bootstrap/Provisioning.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 084b907a5080..6f6d2964c579 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -282,8 +282,12 @@ public function userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles($ $this->featureContext->runOcc(["config:system:get skeletondirectory"]); $path = \trim($this->featureContext->getStdOutOfOccCommand()); $this->featureContext->runOcc(["config:system:delete skeletondirectory"]); - $this->featureContext->userHasBeenCreatedWithDefaultAttributes($user); - $this->featureContext->runOcc(["config:system:set skeletondirectory --value $path"]); + try { + $this->featureContext->userHasBeenCreatedWithDefaultAttributes($user); + } finally { + // restore skeletondirectory even if user creation failed + $this->featureContext->runOcc(["config:system:set skeletondirectory --value $path"]); + } } /**