comparison vendor/behat/mink/src/WebAssert.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
317 * @throws ExpectationException 317 * @throws ExpectationException
318 */ 318 */
319 public function responseContains($text) 319 public function responseContains($text)
320 { 320 {
321 $actual = $this->session->getPage()->getContent(); 321 $actual = $this->session->getPage()->getContent();
322 $regex = '/'.preg_quote($text, '/').'/ui';
323 $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $text); 322 $message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $text);
324 323
325 $this->assert((bool) preg_match($regex, $actual), $message); 324 $this->assert(stripos($actual, $text) !== false, $message);
326 } 325 }
327 326
328 /** 327 /**
329 * Checks that page HTML (response content) does not contains text. 328 * Checks that page HTML (response content) does not contains text.
330 * 329 *
333 * @throws ExpectationException 332 * @throws ExpectationException
334 */ 333 */
335 public function responseNotContains($text) 334 public function responseNotContains($text)
336 { 335 {
337 $actual = $this->session->getPage()->getContent(); 336 $actual = $this->session->getPage()->getContent();
338 $regex = '/'.preg_quote($text, '/').'/ui';
339 $message = sprintf('The string "%s" appears in the HTML response of this page, but it should not.', $text); 337 $message = sprintf('The string "%s" appears in the HTML response of this page, but it should not.', $text);
340 338
341 $this->assert(!preg_match($regex, $actual), $message); 339 $this->assert(stripos($actual, $text) === false, $message);
342 } 340 }
343 341
344 /** 342 /**
345 * Checks that page HTML (response content) matches regex. 343 * Checks that page HTML (response content) matches regex.
346 * 344 *