Skip to content

Commit

Permalink
Reuse existing step
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Oct 12, 2022
1 parent 1faf32d commit 7f5f119
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiMain/main.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Other tests related to api
Scenario: robots.txt file should be accessible
When a user requests "/robots.txt" with "GET" and no authentication
Then the HTTP status code should be "200"
And the content of the requested file in the response should be
And if the HTTP status code was "200" then the downloaded content for multipart byterange should be:
"""
User-agent: *
Disallow: /
Expand Down
32 changes: 0 additions & 32 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2931,38 +2931,6 @@ public function theFileWithContentShouldExistInTheServerRoot(string $path, strin
);
}

/**
* @Then /^the content in the response should match with the content of file "([^"]*)" in the server root$/
*
* @param string $path
*
* @return void
* @throws Exception
*/
public function theContentInTheRespShouldMatchWithFileInTheServerRoot(string $path):void {
$content = $this->getResponse()->getBody()->getContents();
$this->theFileWithContentShouldExistInTheServerRoot($path, $content);
}

/**
* @Then the content of the requested file in the response should be
*
* @param PyStringNode $content
*
* @return void
*/
public function theContentOfTheRequestedFileInTheResponseShouldBe(PyStringNode $content):void {
$actualContent = $this->getResponse()->getBody()->getContents();
$pattern = ["/--\w*/", "/\s*/m"];
$actualContent = \preg_replace($pattern, "", $actualContent);
$expectedString = \preg_replace($pattern, "", $content->getRaw());
Assert::assertSame(
$expectedString,
$actualContent,
"The content of the file does not match with '$expectedString'"
);
}

/**
* @Then the file :path should not exist in the server root
*
Expand Down

0 comments on commit 7f5f119

Please sign in to comment.