Skip to content

Commit 45bf91f

Browse files
Merge pull request #5 from punktDe/add-methods-to-rest
Add further methods to rest
2 parents fbbb597 + a5ac3ec commit 45bf91f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Classes/ActorTraits/Rest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public function theApiResponseJsonPathFieldIsEqual(string $jsonPath, string $val
9393
);
9494
}
9595

96+
9697
/**
9798
* @Given the api response json path :jsonPath does not equal :value
9899
*/
@@ -101,6 +102,7 @@ public function theApiResponseXpathNotEquals(string $jsonPath, string $value)
101102
$this->dontSeeResponseJsonMatchesJsonPath($jsonPath, $value);
102103
}
103104

105+
104106
/**
105107
* @Given the api response should contain headers
106108
*/
@@ -110,4 +112,34 @@ public function theApiResponseShouldContainHeaders(TableNode $table)
110112
$this->seeHttpHeader($row[0], $row[1]);
111113
}
112114
}
115+
116+
117+
/**
118+
* @Given the api response equals :value
119+
*/
120+
public function theApiResponseEquals(string $value)
121+
{
122+
$actual = $this->grabResponse();
123+
Assert::assertEquals(
124+
$value,
125+
$actual,
126+
sprintf('Value of content is not equal expected %s actual %s', $value, $actual)
127+
);
128+
}
129+
130+
/**
131+
* @Given the api response should return a JSON string with json path
132+
*/
133+
public function theApiResponseShouldReturnStringWithJsonPath(TableNode $table)
134+
{
135+
foreach ($table->getRows() as $index => $row) {
136+
$data = $this->grabDataFromResponseByJsonPath($row[0]);
137+
138+
Assert::assertEquals(
139+
$row[1],
140+
$data[0],
141+
sprintf('Value of json path %s is not equal expected %s actual %s', $row[0], $row[1], $data[0])
142+
);
143+
}
144+
}
113145
}

0 commit comments

Comments
 (0)