示例#1
0
 public function testDeprecatedFilterByKeyValue()
 {
     $this->assertCount(0, ArrayUtils::filterByKeyValue($this->_getArrayPreset('empty_array'), 'id', 1));
     $this->assertCount(1, ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5'), 'id', 1));
     $this->assertCount(2, ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5'), 'categoryId', '5'));
     $this->assertCount(2, ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5_named'), 'categoryId', 5));
     $this->assertEmpty(ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5'), 'categoryId', 999));
     $this->assertArrayHasKey('sit', ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5_named'), 'name', 'sit', true));
     $this->assertArrayNotHasKey('sit', ArrayUtils::filterByKeyValue($this->_getArrayPreset('2D_collection_5_named'), 'name', 'sit'));
 }