/** * Test for creating correct demand call * * @test * @return void */ public function listActionFindsDemandedNewsByDemandFromSettings() { $demand = clone new AdministrationDemand(); $settings = array('list' => 'foo', 'orderByAllowed' => NULL); $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $configurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($settings)); $fixture = $this->getMock('GeorgRinger\\News\\Controller\\NewsController', array('createDemandObjectFromSettings', 'emitActionSignal')); $fixture->injectNewsRepository($this->newsRepository); $fixture->injectConfigurationManager($configurationManager); $fixture->setView($this->getMock('Tx_Fluid_View_TemplateView', array(), array(), '', FALSE)); $fixture->expects($this->once())->method('createDemandObjectFromSettings')->with($settings)->will($this->returnValue($demand)); $this->newsRepository->expects($this->once())->method('findDemanded')->with($demand); $fixture->listAction(); }
/** * Set up the doc header properly here * * @param ViewInterface $view */ protected function initializeView(ViewInterface $view) { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); /** @var BackendTemplateView $view */ parent::initializeView($view); $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation([]); $pageRenderer = $this->view->getModuleTemplate()->getPageRenderer(); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->createMenu(); $this->createButtons(); }
/** * Create the demand object which define which records will get shown * * @param array $settings * @return \GeorgRinger\News\Domain\Model\Dto\NewsDemand */ protected function eventCreateDemandObjectFromSettings($settings) { $demand = parent::createDemandObjectFromSettings($settings); $orderByAllowed = $demand->getOrderByAllowed(); if (sizeof($orderByAllowed) > 0) { $orderByAllowed .= ','; } // set ordering if ($settings['event']['orderByAllowed']) { $demand->setOrderByAllowed($orderByAllowed . str_replace(' ', '', $settings['event']['orderByAllowed'])); } else { // default orderByAllowed list $demand->setOrderByAllowed($orderByAllowed . 'tx_roqnewsevent_startdate,tx_roqnewsevent_starttime'); } if ($demand->getArchiveRestriction() == 'archived') { if ($settings['event']['archived']['orderBy']) { $demand->setOrder($settings['event']['archived']['orderBy']); } else { // default ordering for archived events $demand->setOrder('tx_roqnewsevent_startdate DESC, tx_roqnewsevent_starttime DESC'); } } else { if ($settings['event']['orderBy']) { $demand->setOrder($settings['event']['orderBy']); } else { // default ordering for active events $demand->setOrder('tx_roqnewsevent_startdate ASC, tx_roqnewsevent_starttime ASC'); } } if ($settings['event']['startingpoint']) { $demand->setStoragePage(\GeorgRinger\News\Utility\Page::extendPidListByChildren($settings['event']['startingpoint'], $settings['recursive'])); } return $demand; }
/** * Function will be called before every other action * * @return void */ public function initializeAction() { $this->pageUid = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('id'); $this->setTsConfig(); parent::initializeAction(); }
/** * Output a list view of news * * @param array $overwriteDemand * @return void */ public function listAction(array $overwriteDemand = NULL) { // Override demand settings and initialize required view variables for RSS feeds. if (!$this->isHtmlFormat()) { $this->view->assign('language', $this->getTypoScriptFrontendController()->lang); $this->view->assign('currentUrl', GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $this->settings['disableOverrideDemand'] = 0; $overwriteDemand = array('limit' => $this->settings['defaultLimit']['rss'], 'offset' => 0, 'order' => 'datetime desc'); } parent::listAction($overwriteDemand); }