/** * @param object $entity */ protected function fillData($entity) { $data = $this->storage->get(); $this->storage->remove(); if (!$data) { return; } if (!empty($data[ProductDataStorage::ENTITY_DATA_KEY]) && is_array($data[ProductDataStorage::ENTITY_DATA_KEY])) { $this->fillEntityData($entity, $data[ProductDataStorage::ENTITY_DATA_KEY]); } if (!empty($data[ProductDataStorage::ENTITY_ITEMS_DATA_KEY]) && is_array($data[ProductDataStorage::ENTITY_ITEMS_DATA_KEY])) { $itemsData = $data[ProductDataStorage::ENTITY_ITEMS_DATA_KEY]; $this->fillItemsData($entity, $itemsData); } }
/** * @dataProvider getProductsDataProvider * * @param mixed $storageData * @param array $expectedData */ public function testGet($storageData, array $expectedData) { $this->session->expects($this->once())->method('get')->with(ProductDataStorage::PRODUCT_DATA_KEY)->willReturn($storageData); $this->assertEquals($expectedData, $this->storage->get()); }