Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function shouldPrecede($first, $second) { |
||
20 | $page = $this->getSession()->getPage()->getText(); |
||
21 | $pos1 = strpos($page, $first); |
||
22 | if ($pos1 === FALSE) { |
||
23 | throw new ExpectationException("Text not found: '$first'.", $this->getSession()); |
||
24 | } |
||
25 | $pos2 = strpos($page, $second); |
||
26 | if ($pos2 === FALSE) { |
||
27 | throw new ExpectationException("Text not found: '$second'.", $this->getSession()); |
||
28 | } |
||
29 | if ($pos2 < $pos1) { |
||
30 | throw new \Exception("Text '$first' does not precede text '$second'."); |
||
31 | } |
||
32 | } |
||
33 | |||
35 |