/** * {@inheritdoc} */ public function modifyData(array $data) { $model = $this->locator->getProduct(); $data[$model->getId()][self::DATA_SOURCE_DEFAULT]['links_title'] = $this->linksData->getLinksTitle(); $data[$model->getId()][self::DATA_SOURCE_DEFAULT]['links_purchased_separately'] = $this->linksData->isProductLinksCanBePurchasedSeparately() ? '1' : '0'; $data[$model->getId()]['downloadable']['link'] = $this->linksData->getLinksData(); return $data; }
/** * @param int|null $id * @param string $typeId * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetTitle * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $expectedGetValue * @return void * @dataProvider getLinksTitleDataProvider */ public function testGetLinksTitle($id, $typeId, $expectedGetTitle, $expectedGetValue) { $title = 'My Title'; $this->locatorMock->expects($this->any())->method('getProduct')->willReturn($this->productMock); $this->productMock->expects($this->once())->method('getId')->willReturn($id); $this->productMock->expects($this->any())->method('getTypeId')->willReturn($typeId); $this->productMock->expects($expectedGetTitle)->method('getLinksTitle')->willReturn($title); $this->scopeConfigMock->expects($expectedGetValue)->method('getValue')->willReturn($title); $this->assertEquals($title, $this->links->getLinksTitle()); }