Permalink
Browse files

InnerBrowser::see matches UTF-8 text case-insensitively Codeception#3114

  • Loading branch information...
Naktibalda committed May 22, 2016
1 parent e56823a commit 77c07b50c1419e7e3ae7e145f5a813ce4a2cfa47
Showing with 39 additions and 2 deletions.
  1. +30 −2 src/Codeception/PHPUnit/Constraint/Page.php
  2. +9 −0 tests/unit/Codeception/Module/TestsForWeb.php
@@ -3,15 +3,43 @@
use Codeception\Lib\Console\Message;
class Page extends \PHPUnit_Framework_Constraint_StringContains
class Page extends \PHPUnit_Framework_Constraint
{
protected $uri;
public function __construct($string, $uri = '')
{
parent::__construct();
$this->string = (string)$string;
$this->uri = $uri;
$this->ignoreCase = true;
}
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other Value or object to evaluate.
*
* @return bool
*/
protected function matches($other)
{
return mb_stripos($other, $this->string, null, 'UTF-8') !== false;
}
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
$string = mb_strtolower($this->string, 'UTF-8');
return sprintf(
'contains "%s"',
$string
);
}
protected function failureDescription($other)
@@ -60,6 +60,15 @@ public function testSee()
$this->module->dontSee('Welcome', 'h6');
}
/**
* @Issue https://github.com/Codeception/Codeception/issues/3114
*/
public function testSeeIsCaseInsensitiveForUnicodeText()
{
$this->module->amOnPage('/info');
$this->module->see('ссылочка');
}
public function testSeeInSource()
{
$this->module->amOnPage('/');

0 comments on commit 77c07b5

Please sign in to comment.