/** * Single view of a news record * * @param \GeorgRinger\News\Domain\Model\News $news news item * @param int $currentPage current page for optional pagination * @return void */ public function detailAction(\GeorgRinger\News\Domain\Model\News $news = null, $currentPage = 1) { if (is_null($news)) { $previewNewsId = (int) $this->settings['singleNews'] > 0 ? $this->settings['singleNews'] : 0; if ($this->request->hasArgument('news_preview')) { $previewNewsId = (int) $this->request->getArgument('news_preview'); } if ($previewNewsId > 0) { if ($this->isPreviewOfHiddenRecordsEnabled()) { $news = $this->newsRepository->findByUid($previewNewsId, false); } else { $news = $this->newsRepository->findByUid($previewNewsId); } } } if (is_a($news, 'GeorgRinger\\News\\Domain\\Model\\News') && $this->settings['detail']['checkPidOfNewsRecord']) { $news = $this->checkPidOfNewsRecord($news); } if (is_null($news) && isset($this->settings['detail']['errorHandling'])) { $this->handleNoNewsFoundError($this->settings['detail']['errorHandling']); } $demand = $this->createDemandObjectFromSettings($this->settings); $demand->setActionAndClass(__METHOD__, __CLASS__); $assignedValues = ['newsItem' => $news, 'currentPage' => (int) $currentPage, 'demand' => $demand]; $assignedValues = $this->emitActionSignal('NewsController', self::SIGNAL_NEWS_DETAIL_ACTION, $assignedValues); $this->view->assignMultiple($assignedValues); Page::setRegisterProperties($this->settings['detail']['registerProperties'], $news); if (!is_null($news) && is_a($news, 'GeorgRinger\\News\\Domain\\Model\\News')) { Cache::addCacheTagsByNewsRecords([$news]); } }
/** * Test if startingpoint is working * * @test * @return void */ public function findRecordsByUid() { $news = $this->newsRepository->findByUid(1); $this->assertEquals($news->getTitle(), 'findRecordsByUid'); }