mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
CakeTestCase::assertTags() now allows regular expressions for an entire attribute / attribute set
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6744 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
2aff396611
commit
c585658c27
1 changed files with 11 additions and 7 deletions
|
@ -477,15 +477,19 @@ class CakeTestCase extends UnitTestCase {
|
||||||
}
|
}
|
||||||
$attrs = array();
|
$attrs = array();
|
||||||
foreach ($attributes as $attr => $val) {
|
foreach ($attributes as $attr => $val) {
|
||||||
if (is_numeric($attr)) {
|
if (is_numeric($attr) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
|
||||||
$attr = $val;
|
$attrs[] = $matches[1];
|
||||||
$val = '.*?';
|
|
||||||
} else if (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
|
|
||||||
$val = $matches[1];
|
|
||||||
} else {
|
} else {
|
||||||
$val = preg_quote($val, '/');
|
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, '/');
|
||||||
|
}
|
||||||
|
$attrs[] = '[\s]+'.preg_quote($attr, '/').'="'.$val.'"';
|
||||||
}
|
}
|
||||||
$attrs[] = '[\s]+'.preg_quote($attr, '/').'="'.$val.'"';
|
|
||||||
}
|
}
|
||||||
if ($attrs) {
|
if ($attrs) {
|
||||||
$permutations = $this->__array_permute($attrs);
|
$permutations = $this->__array_permute($attrs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue