mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding support for pattern based attribute values in assertTags()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6723 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
db2c2c02d1
commit
fae3b0386a
1 changed files with 13 additions and 7 deletions
|
@ -428,6 +428,10 @@ class CakeTestCase extends UnitTestCase {
|
|||
* '!p'
|
||||
* )
|
||||
*
|
||||
* You can also specify a pattern expression as part of the attribute values if you prepend the value with preg:, and
|
||||
* enclose it with slashes, like so:
|
||||
* array('input' => array('name', 'id' => 'preg:/FieldName\d+/'))
|
||||
*
|
||||
* Important: This function is very forgiving about whitespace and also accepts any permutation of attribute order.
|
||||
*
|
||||
* @param string $string An HTML/XHTML/XML string
|
||||
|
@ -464,6 +468,8 @@ class CakeTestCase extends UnitTestCase {
|
|||
if (is_numeric($attr)) {
|
||||
$attr = $val;
|
||||
$val = '.*?';
|
||||
} else if (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
|
||||
$val = $matches[1];
|
||||
} else {
|
||||
$val = preg_quote($val, '/');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue