Skip to content

Commit

Permalink
removing usage of a stepdefination inside another stepdefination in W…
Browse files Browse the repository at this point in the history
…ebDavPropertiesContext (#8745)
  • Loading branch information
nirajacharya2 committed Apr 17, 2024
1 parent d1b0b9f commit 8556318
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/FavoritesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function theUserHasUnfavoritedElementUsingWebDavApi(string $path):void {
*/
public function asUserFileOrFolderShouldBeFavorited(string $user, string $path, int $expectedValue = 1):void {
$property = "oc:favorite";
$this->webDavPropertiesContext->asUserFolderShouldContainAPropertyWithValue(
$this->webDavPropertiesContext->checkPropertyOfAFolder(
$user,
$path,
$property,
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3495,7 +3495,7 @@ public function userGetsTheFollowingPropertiesOfFileInsideSpaceWithValueUsingThe
string $value
):void {
$this->setSpaceIDByName($user, $spaceName);
$this->webDavPropertiesContext->asUserFolderShouldContainAPropertyWithValue($user, $resourceName, $property, $value);
$this->webDavPropertiesContext->checkPropertyOfAFolder($user, $resourceName, $property, $value);
}

/**
Expand Down
55 changes: 31 additions & 24 deletions tests/acceptance/features/bootstrap/WebDavPropertiesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
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;

Expand Down Expand Up @@ -610,12 +609,23 @@ public function valueOfItemOfPathShouldBe(string $user, string $xpath, string $p
* @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(),
Expand Down Expand Up @@ -897,6 +907,7 @@ public function assertItemInResponseDoesNotExist(string $xpath):void {

/**
* @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
Expand All @@ -912,45 +923,41 @@ public function asUserFolderShouldContainAPropertyWithValueOrWithValue(
string $path,
string $property,
string $expectedValue,
string $altExpectedValue
?string $altExpectedValue = null
):void {
$response = $this->featureContext->listFolder(
$user,
$path,
'0',
[$property]
);
$this->checkResponseContainsAPropertyWithValue(
$response,
$property,
$expectedValue,
$altExpectedValue
);
$this->checkPropertyOfAFolder($user, $path, $property, $expectedValue, $altExpectedValue);
}

/**
* @Then /^as user "([^"]*)" (?:file|folder|entry) "([^"]*)" should contain a property "([^"]*)" with value "([^"]*)"$/
*
* @param string $user
* @param string $path
* @param string $property
* @param string $value
* @param string $expectedValue
* @param string|null $altExpectedValue
*
* @return void
* @throws Exception
*/
public function asUserFolderShouldContainAPropertyWithValue(
public function checkPropertyOfAFolder(
string $user,
string $path,
string $property,
string $value
string $expectedValue,
?string $altExpectedValue = null
):void {
$this->asUserFolderShouldContainAPropertyWithValueOrWithValue(
$response = $this->featureContext->listFolder(
$user,
$path,
'0',
[$property]
);
if ($altExpectedValue === null) {
$altExpectedValue = $expectedValue;
}
$this->checkResponseContainsAPropertyWithValue(
$response,
$property,
$value,
$value
$expectedValue,
$altExpectedValue
);
}

Expand Down

0 comments on commit 8556318

Please sign in to comment.