Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes
This commit is contained in:
parent
4297c64508
commit
b11a755ba8
159 changed files with 2340 additions and 543 deletions
|
@ -259,4 +259,30 @@ class NestedArrayTest extends UnitTestCase {
|
|||
$this->assertSame($expected, $actual, 'drupal_array_merge_deep() ignores numeric key order when merging.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::filter
|
||||
* @dataProvider providerTestFilter
|
||||
*/
|
||||
public function testFilter($array, $callable, $expected) {
|
||||
$this->assertEquals($expected, NestedArray::filter($array, $callable));
|
||||
}
|
||||
|
||||
public function providerTestFilter() {
|
||||
$data = [];
|
||||
$data['1d-array'] = [
|
||||
[0, 1, '', TRUE], NULL, [1 => 1, 3 => TRUE]
|
||||
];
|
||||
$data['1d-array-callable'] = [
|
||||
[0, 1, '', TRUE], function ($element) { return $element === ''; }, [2 => '']
|
||||
];
|
||||
$data['2d-array'] = [
|
||||
[[0, 1, '', TRUE], [0, 1, 2, 3]], NULL, [0 => [1 => 1, 3 => TRUE], 1 => [1 => 1, 2 => 2, 3 => 3]],
|
||||
];
|
||||
$data['2d-array-callable'] = [
|
||||
[[0, 1, '', TRUE], [0, 1, 2, 3]], function ($element) { return is_array($element) || $element === 3; }, [0 => [], 1 => [3 => 3]],
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue