From c585658c274b27f6631d555329e112950d84198d Mon Sep 17 00:00:00 2001 From: "mariano.iglesias" Date: Thu, 1 May 2008 19:35:12 +0000 Subject: [PATCH] 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 --- cake/tests/lib/cake_test_case.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index ef2894c5d..53d09db11 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -477,15 +477,19 @@ class CakeTestCase extends UnitTestCase { } $attrs = array(); foreach ($attributes as $attr => $val) { - if (is_numeric($attr)) { - $attr = $val; - $val = '.*?'; - } else if (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) { - $val = $matches[1]; + if (is_numeric($attr) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) { + $attrs[] = $matches[1]; } 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) { $permutations = $this->__array_permute($attrs);