25 $factoryMock = $this->createMock(EntityFactoryInterface::class);
26 $this->collection =
new Collection($factoryMock);
35 $objOne = new \Magento\Framework\DataObject([
'id' => 1,
'name' =>
'one']);
36 $objTwo = new \Magento\Framework\DataObject([
'id' => 2,
'name' =>
'two']);
37 $objThree = new \Magento\Framework\DataObject([
'id' => 3,
'name' =>
'three']);
39 $this->collection->addItem($objOne);
40 $this->collection->addItem($objTwo);
41 $this->collection->addItem($objThree);
43 $this->assertEquals([1, 2, 3], $this->collection->getAllIds(),
'Items added incorrectly to the collection');
44 $this->collection->walk([$this,
'modifyObjectNames'], [
'test prefix']);
46 $this->assertEquals([1, 2, 3], $this->collection->getAllIds(),
'Incorrect IDs after callback function');
55 $this->collection->getColumnValues(
'name'),
56 'Incorrect Names after callback function' 68 $object->setData(
'name',
$prefix .
' ' . $object->getData(
'name'));
modifyObjectNames(\Magento\Framework\DataObject $object, $prefix)