/** * @dataProvider linkDataProvider * @test * @param \PHPUnit_Framework_MockObject_MockObject $categoryMock * @param \PHPUnit_Framework_MockObject_MockObject $filterMock * @param $type * @param $expected */ public function testGetFilterByCategory(\PHPUnit_Framework_MockObject_MockObject $categoryMock, \PHPUnit_Framework_MockObject_MockObject $filterMock, $type, $expected) { $filterMock->method('isMultiSelectFilter')->willReturn($type); $this->filterRepository->expects($this->once())->method('findOneByCategories')->with($categoryMock)->willReturn($filterMock); $this->viewHelper->render(1, array(), 0, false, false, '', false, false, false, array(), null, $categoryMock); $this->assertSame($expected, $this->viewHelper->getAdditionalParams()); }
/** * @param null $pageUid * @param array $additionalParams * @param int $pageType * @param bool|false $noCache * @param bool|false $noCacheHash * @param string $section * @param bool|false $linkAccessRestrictedPages * @param bool|false $absolute * @param bool|false $addQueryString * @param array $argumentsToBeExcludedFromQueryString * @param null $addQueryStringMethod * @param Category|null $category * @return string */ public function render($pageUid = null, array $additionalParams = array(), $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $linkAccessRestrictedPages = false, $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = null, $category = null) { $this->additionalParams = $additionalParams; /* @var $filter \Pws\KesearchCategories\Domain\Model\Filter */ if (($category instanceof Category || is_numeric($category) && ($category = $this->categoryRepository->findByUid($category))) && ($filter = $this->filterRepository->findOneByCategories($category))) { $this->additionalParams['tx_kesearch_pi1']['filter'] = $this->setUpFilterQuery($category, $filter); } return parent::render($pageUid, $this->additionalParams, $pageType, $noCache, $noCacheHash, $section, $linkAccessRestrictedPages, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString, $addQueryStringMethod); }