|
@@ -31,12 +31,12 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
|
|
32
|
32
|
// @todo this could be part of an abstract class |
|
33
|
33
|
if ($this->useDom) { |
|
34
|
|
- $content = (string)$response->getBody(); |
|
|
34
|
+ $content = (string) $response->getBody(); |
|
35
|
35
|
} else { |
|
36
|
36
|
if ($response instanceof DomAwareResponse) { |
|
37
|
37
|
$content = $response->getHtmlBody(); |
|
38
|
38
|
} else { |
|
39
|
|
- $content = (string)$response->getBody(); |
|
|
39
|
+ $content = (string) $response->getBody(); |
|
40
|
40
|
} |
|
41
|
41
|
} |
|
42
|
42
|
|
|
@@ -48,16 +48,16 @@ discard block |
|
|
block discarded – undo |
|
48
|
48
|
$count = $domXPath->query($xpath['pattern'])->length; |
|
49
|
49
|
|
|
50
|
50
|
if ($xpath['relation'] === 'equals') { |
|
51
|
|
- $result = $count === (int)$xpath['value']; |
|
52
|
|
- $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were exact ' . $xpath['value'] . ' occurencies.'; |
|
|
51
|
+ $result = $count === (int) $xpath['value']; |
|
|
52
|
+ $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were exact '.$xpath['value'].' occurencies.'; |
|
53
|
53
|
} elseif ($xpath['relation'] === 'less than') { |
|
54
|
|
- $result = $count < (int)$xpath['value']; |
|
55
|
|
- $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were less than ' . $xpath['value'] . '.'; |
|
|
54
|
+ $result = $count < (int) $xpath['value']; |
|
|
55
|
+ $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were less than '.$xpath['value'].'.'; |
|
56
|
56
|
} elseif ($xpath['relation'] === 'greater than') { |
|
57
|
|
- $result = $count > (int)$xpath['value']; |
|
58
|
|
- $message = 'The xpath "' . $xpath['pattern'] . '" was found ' . $count . ' times. Expected were more than ' . $xpath['value'] . '.'; |
|
|
57
|
+ $result = $count > (int) $xpath['value']; |
|
|
58
|
+ $message = 'The xpath "'.$xpath['pattern'].'" was found '.$count.' times. Expected were more than '.$xpath['value'].'.'; |
|
59
|
59
|
} else { |
|
60
|
|
- throw new \RuntimeException('Relation not defined. Given "' . $xpath['relation'] . '" expected [equals, greater than, less than]'); |
|
|
60
|
+ throw new \RuntimeException('Relation not defined. Given "'.$xpath['relation'].'" expected [equals, greater than, less than]'); |
|
61
|
61
|
} |
|
62
|
62
|
|
|
63
|
63
|
$this->assert($result, $message); |