diff --git a/tests/acceptance/features/bootstrap/FavoritesContext.php b/tests/acceptance/features/bootstrap/FavoritesContext.php index 7eaad10567..da270a24a7 100644 --- a/tests/acceptance/features/bootstrap/FavoritesContext.php +++ b/tests/acceptance/features/bootstrap/FavoritesContext.php @@ -252,7 +252,7 @@ class FavoritesContext implements Context { */ public function asUserFileOrFolderShouldBeFavorited(string $user, string $path, int $expectedValue = 1):void { $property = "oc:favorite"; - $this->webDavPropertiesContext->asUserFolderShouldContainAPropertyWithValue( + $this->webDavPropertiesContext->checkPropertyOfAFolder( $user, $path, $property, diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 9d508e4819..8c67ac107e 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -3495,7 +3495,7 @@ class SpacesContext implements Context { string $value ):void { $this->setSpaceIDByName($user, $spaceName); - $this->webDavPropertiesContext->asUserFolderShouldContainAPropertyWithValue($user, $resourceName, $property, $value); + $this->webDavPropertiesContext->checkPropertyOfAFolder($user, $resourceName, $property, $value); } /** diff --git a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php index eaa303738c..c4b111109b 100644 --- a/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php +++ b/tests/acceptance/features/bootstrap/WebDavPropertiesContext.php @@ -25,7 +25,6 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope; use Behat\Gherkin\Node\TableNode; use PHPUnit\Framework\Assert; use TestHelpers\Asserts\WebDav as WebDavTest; -use TestHelpers\HttpRequestHelper; use TestHelpers\WebDavHelper; use Psr\Http\Message\ResponseInterface; @@ -610,12 +609,23 @@ class WebDavPropertiesContext implements Context { * @Then the value of the item :xpath in the response about user :user should be :value * * @param string $xpath - * @param string|null $user + * @param string $user * @param string $expectedValue * * @return void * @throws Exception */ + public function theValueOfTheItemInTheResponseAboutUserShouldBe(string $xpath, string $user, string $expectedValue):void { + $this->assertValueOfItemInResponseAboutUserIs($xpath, $user, $expectedValue); + } + + /** + * @param string $xpath + * @param string|null $user + * @param string $expectedValue + * + * @return void + */ public function assertValueOfItemInResponseAboutUserIs(string $xpath, ?string $user, string $expectedValue):void { $resXml = $this->featureContext->getResponseXml( $this->featureContext->getResponse(), @@ -897,6 +907,7 @@ class WebDavPropertiesContext implements Context { /** * @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)" or with value "([^"]*)"$/ + * @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)"$/ * * @param string $user * @param string $path @@ -912,7 +923,26 @@ class WebDavPropertiesContext implements Context { string $path, string $property, string $expectedValue, - string $altExpectedValue + ?string $altExpectedValue = null + ):void { + $this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue); + } + + /** + * @param string $user + * @param string $path + * @param string $property + * @param string $expectedValue + * @param string|null $altExpectedValue + * + * @return void + */ + public function checkPropertyOfAFolder( + string $user, + string $path, + string $property, + string $expectedValue, + ?string $altExpectedValue = null ):void { $response = $this->featureContext->listFolder( $user, @@ -920,6 +950,9 @@ class WebDavPropertiesContext implements Context { '0', [$property] ); + if ($altExpectedValue === null) { + $altExpectedValue = $expectedValue; + } $this->checkResponseContainsAPropertyWithValue( $response, $property, @@ -928,32 +961,6 @@ class WebDavPropertiesContext implements Context { ); } - /** - * @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)"$/ - * - * @param string $user - * @param string $path - * @param string $property - * @param string $value - * - * @return void - * @throws Exception - */ - public function asUserFolderShouldContainAPropertyWithValue( - string $user, - string $path, - string $property, - string $value - ):void { - $this->asUserFolderShouldContainAPropertyWithValueOrWithValue( - $user, - $path, - $property, - $value, - $value - ); - } - /** * @Then the single response should contain a property :key with value like :regex *