mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed a bug in Set::extract. Wrong key returned when two arrays are at the extraction level.
Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
4ac29963a8
commit
bdfb50e6bb
2 changed files with 16 additions and 1 deletions
|
@ -454,7 +454,7 @@ class Set extends Object {
|
|||
$item = $items[$token];
|
||||
$matches[] = array(
|
||||
'trace' => array_merge($context['trace'], $ctext),
|
||||
'key' => $key,
|
||||
'key' => $token,
|
||||
'item' => $item,
|
||||
);
|
||||
break;
|
||||
|
|
|
@ -1027,6 +1027,20 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array('Second');
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
/**
|
||||
* testExtractWithArrays method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testExtractWithArrays() {
|
||||
$data = array(
|
||||
'Level1' => array(
|
||||
'Level2' => array('test1', 'test2'),
|
||||
'Level2bis' => array('test3', 'test4')));
|
||||
$this->assertEqual(Set::extract('/Level1/Level2', $data), array(array('Level2' => array('test1', 'test2'))));
|
||||
$this->assertEqual(Set::extract('/Level1/Level2bis', $data), array(array('Level2bis' => array('test3', 'test4'))));
|
||||
}
|
||||
/**
|
||||
* testMatches method
|
||||
*
|
||||
|
@ -1099,6 +1113,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* testSetExtractReturnsEmptyArray method
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue