mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Use alternate quoting in assertTags()
When a preg pattern contains no `.` it probably doesn't need quote anchors.
This commit is contained in:
parent
f12b272758
commit
a801be30d9
1 changed files with 2 additions and 1 deletions
|
@ -448,12 +448,13 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
||||||
$val = '.+?';
|
$val = '.+?';
|
||||||
$explanations[] = sprintf('Attribute "%s" present', $attr);
|
$explanations[] = sprintf('Attribute "%s" present', $attr);
|
||||||
} elseif (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
|
} elseif (!empty($val) && preg_match('/^preg\:\/(.+)\/$/i', $val, $matches)) {
|
||||||
$quotes = '["\']';
|
|
||||||
$val = str_replace(
|
$val = str_replace(
|
||||||
array('.*', '.+'),
|
array('.*', '.+'),
|
||||||
array('.*?', '.+?'),
|
array('.*?', '.+?'),
|
||||||
$matches[1]
|
$matches[1]
|
||||||
);
|
);
|
||||||
|
$quotes = $val !== $matches[1] ? '["\']' : '["\']?';
|
||||||
|
|
||||||
$explanations[] = sprintf('Attribute "%s" matches "%s"', $attr, $val);
|
$explanations[] = sprintf('Attribute "%s" matches "%s"', $attr, $val);
|
||||||
} else {
|
} else {
|
||||||
$explanations[] = sprintf('Attribute "%s" == "%s"', $attr, $val);
|
$explanations[] = sprintf('Attribute "%s" == "%s"', $attr, $val);
|
||||||
|
|
Loading…
Reference in a new issue