mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Added support for numeric values in expectation of assertTags().
Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
02f9275e20
commit
bb92a47ddb
2 changed files with 54 additions and 0 deletions
|
@ -164,6 +164,57 @@ class CakeTestCaseTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* testNumericValuesInExpectationForAssertTags
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function testNumericValuesInExpectationForAssertTags() {
|
||||
$value = 220985;
|
||||
|
||||
$input = '<p><strong>' . $value . '</strong></p>';
|
||||
$pattern = array(
|
||||
'p' => array(),
|
||||
'strong' => array(),
|
||||
$value,
|
||||
'/strong',
|
||||
'/p'
|
||||
);
|
||||
$this->assertTrue($this->Case->assertTags($input, $pattern));
|
||||
|
||||
$input = '<p><strong>' . $value . '</strong></p><p><strong>' . $value . '</strong></p>';
|
||||
$pattern = array(
|
||||
array('p' => array()),
|
||||
array('strong' => array()),
|
||||
$value,
|
||||
'/strong',
|
||||
'/p',
|
||||
array('p' => array()),
|
||||
array('strong' => array()),
|
||||
$value,
|
||||
'/strong',
|
||||
'/p',
|
||||
);
|
||||
$this->assertTrue($this->Case->assertTags($input, $pattern));
|
||||
|
||||
$input = '<p><strong>' . $value . '</strong></p><p id="' . $value . '"><strong>' . $value . '</strong></p>';
|
||||
$pattern = array(
|
||||
array('p' => array()),
|
||||
array('strong' => array()),
|
||||
$value,
|
||||
'/strong',
|
||||
'/p',
|
||||
array('p' => array('id' => $value)),
|
||||
array('strong' => array()),
|
||||
$value,
|
||||
'/strong',
|
||||
'/p',
|
||||
);
|
||||
$this->assertTrue($this->Case->assertTags($input, $pattern));
|
||||
}
|
||||
|
||||
/**
|
||||
* testBadAssertTags
|
||||
*
|
||||
* @access public
|
||||
|
|
|
@ -586,6 +586,9 @@ class CakeTestCase extends UnitTestCase {
|
|||
}
|
||||
$i = 0;
|
||||
foreach ($normalized as $tags) {
|
||||
if (!is_array($tags)) {
|
||||
$tags = (string)$tags;
|
||||
}
|
||||
$i++;
|
||||
if (is_string($tags) && $tags{0} == '<') {
|
||||
$tags = array(substr($tags, 1) => array());
|
||||
|
|
Loading…
Add table
Reference in a new issue