|
@@ 132-149 (lines=18) @@
|
| 129 |
|
* @throws PHPUnit_Framework_AssertionFailedError |
| 130 |
|
* @return boolean |
| 131 |
|
*/ |
| 132 |
|
public function assertSelectorStartsWithOrEquals($selector, $index, $expectedPrefix) { |
| 133 |
|
$items = $this->cssParser()->getBySelector($selector); |
| 134 |
|
|
| 135 |
|
$ctr = 0; |
| 136 |
|
foreach ($items as $item) { |
| 137 |
|
$text = strip_tags($item); |
| 138 |
|
$escaped = str_replace("'", "\'", $text); |
| 139 |
|
$ctr++; |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
$ctr = 0; |
| 143 |
|
$item = strip_tags($items[$index]); |
| 144 |
|
|
| 145 |
|
$errorMessage = "Failed to assert that '$item' started with '$expectedPrefix'"; |
| 146 |
|
$this->assertStringStartsWith($expectedPrefix, $item, $errorMessage); |
| 147 |
|
|
| 148 |
|
return true; |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
|
| 152 |
|
/** |
|
@@ 162-179 (lines=18) @@
|
| 159 |
|
* @throws PHPUnit_Framework_AssertionFailedError |
| 160 |
|
* @return boolean |
| 161 |
|
*/ |
| 162 |
|
public function assertSelectorContains($selector, $index, $expectedClause) { |
| 163 |
|
$items = $this->cssParser()->getBySelector($selector); |
| 164 |
|
|
| 165 |
|
$ctr = 0; |
| 166 |
|
foreach ($items as $item) { |
| 167 |
|
$text = strip_tags($item); |
| 168 |
|
$escaped = str_replace("'", "\'", $text); |
| 169 |
|
$ctr++; |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
$ctr = 0; |
| 173 |
|
$item = strip_tags($items[$index]); |
| 174 |
|
|
| 175 |
|
$errorMessage = "Failed to assert that '$item' started with '$expectedClause'"; |
| 176 |
|
$this->assertContains($expectedClause, $item, $errorMessage); |
| 177 |
|
|
| 178 |
|
return true; |
| 179 |
|
} |
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|