2015-12-02 12:29:42 -05:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-07-21 12:13:36 -04:00
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-07-21 12:13:36 -04:00
|
|
|
*/
|
2015-12-02 12:29:42 -05:00
|
|
|
use Behat\Behat\Context\Context;
|
|
|
|
|
use Behat\Behat\Context\SnippetAcceptingContext;
|
2018-06-13 01:15:42 -04:00
|
|
|
use PHPUnit\Framework\Assert;
|
2015-12-02 12:29:42 -05:00
|
|
|
|
2025-11-26 10:13:47 -05:00
|
|
|
require __DIR__ . '/autoload.php';
|
2015-12-02 12:29:42 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Capabilities context.
|
|
|
|
|
*/
|
|
|
|
|
class CapabilitiesContext implements Context, SnippetAcceptingContext {
|
|
|
|
|
use BasicStructure;
|
2016-03-15 09:23:41 -04:00
|
|
|
use AppConfiguration;
|
2015-12-04 09:08:16 -05:00
|
|
|
|
2015-12-02 12:29:42 -05:00
|
|
|
/**
|
|
|
|
|
* @Then /^fields of capabilities match with$/
|
|
|
|
|
* @param \Behat\Gherkin\Node\TableNode|null $formData
|
|
|
|
|
*/
|
2020-04-09 07:53:40 -04:00
|
|
|
public function checkCapabilitiesResponse(\Behat\Gherkin\Node\TableNode $formData) {
|
2024-07-10 10:59:26 -04:00
|
|
|
$capabilitiesXML = simplexml_load_string($this->response->getBody());
|
|
|
|
|
Assert::assertNotFalse($capabilitiesXML, 'Failed to fetch capabilities');
|
|
|
|
|
$capabilitiesXML = $capabilitiesXML->data->capabilities;
|
2015-12-09 10:08:14 -05:00
|
|
|
|
|
|
|
|
foreach ($formData->getHash() as $row) {
|
2015-12-11 07:39:04 -05:00
|
|
|
$path_to_element = explode('@@@', $row['path_to_element']);
|
2016-03-08 08:52:54 -05:00
|
|
|
$answeredValue = $capabilitiesXML->{$row['capability']};
|
2015-12-11 07:39:04 -05:00
|
|
|
for ($i = 0; $i < count($path_to_element); $i++) {
|
2016-03-08 08:52:54 -05:00
|
|
|
$answeredValue = $answeredValue->{$path_to_element[$i]};
|
2015-12-02 12:29:42 -05:00
|
|
|
}
|
2015-12-11 07:39:04 -05:00
|
|
|
$answeredValue = (string)$answeredValue;
|
2018-06-13 01:15:42 -04:00
|
|
|
Assert::assertEquals(
|
2020-10-05 09:12:57 -04:00
|
|
|
$row['value'] === 'EMPTY' ? '' : $row['value'],
|
2015-12-11 07:39:04 -05:00
|
|
|
$answeredValue,
|
|
|
|
|
'Failed field ' . $row['capability'] . ' ' . $row['path_to_element']
|
|
|
|
|
);
|
2015-12-02 12:29:42 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-11 09:28:21 -05:00
|
|
|
protected function resetAppConfigs() {
|
2020-11-12 05:51:37 -05:00
|
|
|
$this->deleteServerConfig('core', 'shareapi_enabled');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_allow_links');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_allow_public_upload');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_allow_resharing');
|
|
|
|
|
$this->deleteServerConfig('files_sharing', 'outgoing_server2server_share_enabled');
|
|
|
|
|
$this->deleteServerConfig('files_sharing', 'incoming_server2server_share_enabled');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_enforce_links_password');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_allow_public_notification');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_default_expire_date');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_enforce_expire_date');
|
|
|
|
|
$this->deleteServerConfig('core', 'shareapi_allow_group_sharing');
|
2015-12-11 09:28:21 -05:00
|
|
|
}
|
2015-12-02 12:29:42 -05:00
|
|
|
}
|