|
@@ 43-54 (lines=12) @@
|
| 40 |
|
* |
| 41 |
|
* @Then :count element(s) should match :selector |
| 42 |
|
*/ |
| 43 |
|
public function assertSelectorMatch($selector, $count) { |
| 44 |
|
$session = $this->getSession(); |
| 45 |
|
|
| 46 |
|
$result = count($session->getPage()->findAll('css', $selector)); |
| 47 |
|
|
| 48 |
|
if ($result != $count) { |
| 49 |
|
throw new ExpectationException( |
| 50 |
|
'"' . $selector . '" matched ' . $result . ' element(s), expected ' . $count . '.', |
| 51 |
|
$session->getDriver() |
| 52 |
|
); |
| 53 |
|
} |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
/** |
| 57 |
|
* Asserts that a minimum number of elements match a CSS selector. |
|
@@ 69-80 (lines=12) @@
|
| 66 |
|
* |
| 67 |
|
* @Then at least :count element(s) should match :selector |
| 68 |
|
*/ |
| 69 |
|
public function assertSelectorMatchAtLeast($selector, $count) { |
| 70 |
|
$session = $this->getSession(); |
| 71 |
|
|
| 72 |
|
$result = count($session->getPage()->findAll('css', $selector)); |
| 73 |
|
|
| 74 |
|
if ($result < $count) { |
| 75 |
|
throw new ExpectationException( |
| 76 |
|
'"' . $selector . '" matched ' . $result . ' element(s), expected at least ' . $count . '.', |
| 77 |
|
$session->getDriver() |
| 78 |
|
); |
| 79 |
|
} |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
/** |
| 83 |
|
* Asserts that no elements match a CSS selector. |