mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Allowing regular expressions as part of the tag construction in assertTags()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6725 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
2902969504
commit
3f0b8217ec
1 changed files with 12 additions and 4 deletions
|
@ -428,9 +428,12 @@ 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+/'))
|
||||
* You can also specify a pattern expression as part of the attribute values, or the tag being defined,
|
||||
* if you prepend the value with preg: and enclose it with slashes, like so:
|
||||
* array(
|
||||
* array('input' => array('name', 'id' => 'preg:/FieldName\d+/')),
|
||||
* 'preg:/My\s+field/'
|
||||
* )
|
||||
*
|
||||
* Important: This function is very forgiving about whitespace and also accepts any permutation of attribute order.
|
||||
*
|
||||
|
@ -458,7 +461,12 @@ class CakeTestCase extends UnitTestCase {
|
|||
$regex[] = '<[\s]*\/[\s]*'.substr($tags, 1).'[\s]*>';
|
||||
continue;
|
||||
}
|
||||
$regex[] = preg_quote($tags, '/');
|
||||
if (!empty($tags) && preg_match('/^preg\:\/(.+)\/$/i', $tags, $matches)) {
|
||||
$tags = $matches[1];
|
||||
} else {
|
||||
$tags = preg_quote($tags, '/');
|
||||
}
|
||||
$regex[] = $tags;
|
||||
continue;
|
||||
}
|
||||
foreach ($tags as $tag => $attributes) {
|
||||
|
|
Loading…
Reference in a new issue