public function testFillFromSearchResult() { $data = ['foo', 'bar']; $link = 'http://example.com/?' . http_build_query([FillerForm::FORM_NAME => $data]); $result = $this->getMock('\\AnimeDb\\Bundle\\CatalogBundle\\Entity\\Item'); /* @var $item \PHPUnit_Framework_MockObject_MockObject|ItemSearch */ $item = $this->getMockBuilder('\\AnimeDb\\Bundle\\CatalogBundle\\Plugin\\Fill\\Search\\Item')->disableOriginalConstructor()->getMock(); $item->expects($this->once())->method('getLink')->will($this->returnValue($link)); $this->filler->expects($this->once())->method('fill')->will($this->returnValue($result))->with($data); $this->assertEquals($result, $this->filler->fillFromSearchResult($item)); }
/** * Build menu for plugin. * * @param ItemInterface $item * * @return ItemInterface */ public function buildMenu(ItemInterface $item) { return parent::buildMenu($item)->setLinkAttribute('class', 'icon-label icon-label-plugin-anidb'); }