/** * List categories * * @param array $overwriteDemand * @return void */ public function listAction(array $overwriteDemand = NULL) { // Default value is wrong for tags if ($this->settings['orderBy'] === 'datetime') { unset($this->settings['orderBy']); } $demand = $this->createDemandObjectFromSettings($this->settings); if ($this->settings['disableOverrideDemand'] != 1 && $overwriteDemand !== NULL) { $demand = $this->overwriteDemandObject($demand, $overwriteDemand); } $assignedValues = array('tags' => $this->tagRepository->findDemanded($demand), 'overwriteDemand' => $overwriteDemand, 'demand' => $demand); $this->emitActionSignal('TagController', self::SIGNAL_TAG_LIST_ACTION, $assignedValues); $this->view->assignMultiple($assignedValues); }
/** * Test for creating correct demand call * * @test * @return void */ public function listActionFindsDemandedTagsByDemandFromSettings() { $demand = new NewsDemand(); $settings = array('list' => 'foo', 'orderBy' => 'datetime'); $mockedSignalSlotDispatcher = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher', array('dispatch')); $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $fixture = $this->getAccessibleMock('GeorgRinger\\News\\Controller\\TagController', array('createDemandObjectFromSettings')); $fixture->_set('signalSlotDispatcher', $mockedSignalSlotDispatcher); $fixture->injectTagRepository($this->tagRepository); $fixture->injectConfigurationManager($configurationManager); $fixture->setView($this->getMock('Tx_Fluid_View_TemplateView', array(), array(), '', FALSE)); $fixture->_set('settings', $settings); $fixture->expects($this->once())->method('createDemandObjectFromSettings')->will($this->returnValue($demand)); $this->tagRepository->expects($this->once())->method('findDemanded')->with($demand); $fixture->listAction(); // datetime must be removed $this->assertEquals($fixture->_get('settings'), array('list' => 'foo')); }