|
@@ 26-42 (lines=17) @@
|
| 23 |
|
} |
| 24 |
|
|
| 25 |
|
/** @Then the response content should match :pattern */ |
| 26 |
|
public function response_content_should_match(string $pattern) |
| 27 |
|
{ |
| 28 |
|
$matcher = $this->factory->createMatcher(); |
| 29 |
|
$content = (string) $this->getResponse()->getBody(); |
| 30 |
|
|
| 31 |
|
if ($matcher->match($content, $pattern)) { |
| 32 |
|
return; |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
throw new InvalidArgumentException( |
| 36 |
|
sprintf( |
| 37 |
|
'The response does not match with the pattern "%s" (error : %s)', |
| 38 |
|
$pattern, |
| 39 |
|
$matcher->getError() |
| 40 |
|
) |
| 41 |
|
); |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
/** @Then the response content should not match :pattern */ |
| 45 |
|
public function response_content_should_not_match(string $pattern) |
|
@@ 45-61 (lines=17) @@
|
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
/** @Then the response content should not match :pattern */ |
| 45 |
|
public function response_content_should_not_match(string $pattern) |
| 46 |
|
{ |
| 47 |
|
$matcher = $this->factory->createMatcher(); |
| 48 |
|
$content = (string) $this->getResponse()->getBody(); |
| 49 |
|
|
| 50 |
|
if (!$matcher->match($content, $pattern)) { |
| 51 |
|
return; |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
throw new InvalidArgumentException( |
| 55 |
|
sprintf( |
| 56 |
|
'The response matches with the pattern "%s" (error : %s)', |
| 57 |
|
$pattern, |
| 58 |
|
$matcher->getError() |
| 59 |
|
) |
| 60 |
|
); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
/** @Then the response content should match: */ |
| 64 |
|
public function response_content_should_match_PyString(PyStringNode $pattern) |
|
@@ 64-74 (lines=11) @@
|
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
/** @Then the response content should match: */ |
| 64 |
|
public function response_content_should_match_PyString(PyStringNode $pattern) |
| 65 |
|
{ |
| 66 |
|
$matcher = $this->factory->createMatcher(); |
| 67 |
|
$content = (string) $this->getResponse()->getBody(); |
| 68 |
|
|
| 69 |
|
if ($matcher->match($content, $pattern)) { |
| 70 |
|
return; |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
throw new InvalidArgumentException($matcher->getError()); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** @Then the response content should match: */ |
| 77 |
|
public function response_content_should_not_match_PyString(PyStringNode $pattern) |
|
@@ 77-87 (lines=11) @@
|
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** @Then the response content should match: */ |
| 77 |
|
public function response_content_should_not_match_PyString(PyStringNode $pattern) |
| 78 |
|
{ |
| 79 |
|
$matcher = $this->factory->createMatcher(); |
| 80 |
|
$content = (string) $this->getResponse()->getBody(); |
| 81 |
|
|
| 82 |
|
if (!$matcher->match($content, $pattern)) { |
| 83 |
|
return; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
throw new InvalidArgumentException($matcher->getError()); |
| 87 |
|
} |
| 88 |
|
} |
| 89 |
|
|