diff options
author | Sergio Bertolin <sbertolin@solidgear.es> | 2015-12-09 10:27:30 +0000 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-11 16:20:04 +0100 |
commit | 0449dc387b7ca8de56ccf76084b542ca8455c885 (patch) | |
tree | e1ab9db54f8a7aa845e0c1c1225c1c1458ed5982 /build/integration/features/bootstrap/CapabilitiesContext.php | |
parent | 4338a741f256a96c53aae30e495e6c5587587865 (diff) | |
download | nextcloud-server-0449dc387b7ca8de56ccf76084b542ca8455c885.tar.gz nextcloud-server-0449dc387b7ca8de56ccf76084b542ca8455c885.zip |
Added functionality to change server configuration
Diffstat (limited to 'build/integration/features/bootstrap/CapabilitiesContext.php')
-rw-r--r-- | build/integration/features/bootstrap/CapabilitiesContext.php | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/build/integration/features/bootstrap/CapabilitiesContext.php b/build/integration/features/bootstrap/CapabilitiesContext.php index 0e5d990f9a6..9cdd98cc059 100644 --- a/build/integration/features/bootstrap/CapabilitiesContext.php +++ b/build/integration/features/bootstrap/CapabilitiesContext.php @@ -14,23 +14,16 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext { use Provisioning; use Sharing; - private $apacheUser = ''; + private $apacheUser = NULL; /** - * @Given /^parameter "([^"]*)" is set to "([^"]*)"$/ + * @Given /^parameter "([^"]*)" of app "([^"]*)" is set to "([^"]*)"$/ */ - public function modifyServerConfig($parameter, $value){ - $this->apacheUser = exec('ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk \'END {if ($1) print $1}\''); - $comando = 'sudo -u ' . $this->apacheUser . ' ../../occ config:app:set ' . $parameter . ' ' . $value; - echo "COMANDO: $comando\n"; - $expectedAnswer = "Config value $value for app $parameter set to"; - $output = exec($comando); - PHPUnit_Framework_Assert::assertEquals( - $output, - $expectedAnswer, - "Failed setting $parameter to $value" - ); - + public function serverParameterIsSetTo($parameter, $app, $value){ + if (!isset($this->apacheUser)){ + $this->apacheUser = $this->getOSApacheUser(); + } + $this->modifyServerConfig($this->apacheUser, $parameter, $app, $value); } /** @@ -56,11 +49,43 @@ class CapabilitiesContext implements Context, SnippetAcceptingContext { $answeredValue = (string)$capabilitiesXML->$row['capability']->$row['feature']->$row['value_or_subfeature']; PHPUnit_Framework_Assert::assertEquals( $answeredValue, - $row['value'], + $row['value']==="EMPTY" ? '' : $row['value'], "Failed field: " . $row['capability'] . " " . $row['feature'] . " " . $row['value_or_subfeature'] ); } } } + public static function modifyServerConfig($apacheUser, $parameter, $app, $value){ + $comando = 'sudo -u ' . $apacheUser . ' ../../occ config:app:set ' . $app . " " . $parameter . ' --value=' . $value; + $expectedAnswer = "Config value $parameter for app $app set to $value"; + $output = exec($comando); + PHPUnit_Framework_Assert::assertEquals( + $output, + $expectedAnswer, + "Failed setting $parameter to $value" + ); + + } + + public static function getOSApacheUser(){ + return exec('ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk \'END {if ($1) print $1}\''); + } + + /** + * @BeforeSuite + */ + public static function prepareParameters(){ + $apacheUser = self::getOSApacheUser(); + self::modifyServerConfig($apacheUser, "shareapi_allow_public_upload", "core", "yes"); + } + + /** + * @AfterSuite + */ + public static function undoChangingParameters(){ + $apacheUser = self::getOSApacheUser(); + self::modifyServerConfig($apacheUser, "shareapi_allow_public_upload", "core", "yes"); + } + } |