Skip to content

Commit

Permalink
Test: Hash::extract handling numeric value condition
Browse files Browse the repository at this point in the history
  • Loading branch information
o0h committed Feb 5, 2018
1 parent 9e7bdbc commit 1dd631b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/TestCase/Utility/HashTest.php
Expand Up @@ -1421,6 +1421,26 @@ public function testExtractMatchesNull()
$this->assertEquals($expected, $result);
}

/**
* Test extracting value-zero contained data based on attributes with string
*
* @return void
*/
public function testExtractAttributeStringWithDataContainsZero()
{
$data = [
['value' => '0'],
['value' => 0],
['value' => 'string-value'],
];

$expected = [
['value' => 'string-value'],
];
$result = Hash::extract($data, '{n}[value=string-value]');
$this->assertSame($expected, $result);
}

/**
* Test that uneven keys are handled correctly.
*
Expand Down

0 comments on commit 1dd631b

Please sign in to comment.