public function testGetPublicationDate() { $this->assertInstanceOf('\\DateTime', $this->article->getPublicationDate()); $this->assertEquals('2015', $this->article->getPublicationDate()->format('Y')); $this->assertEquals('06', $this->article->getPublicationDate()->format('m')); $this->assertEquals('27', $this->article->getPublicationDate()->format('d')); }
/** * @param ArticleTemplateInterface $articleTemplate * @param OutletTemplateInterface $outletTemplate * @param OutputInterface $output * * @return bool */ protected function processArticleTemplateAndSaveData(ArticleTemplateInterface $articleTemplate, OutletTemplateInterface $outletTemplate, OutputInterface $output) { $output->writeln(sprintf('<comment>[+] %s - Synchronizing the article "%s" posted by "%s" at "%s" ...</comment>', date('Y-m-d H:i:s'), $articleTemplate->getTitle(), $articleTemplate->getAuthor()->getName(), $articleTemplate->getPublicationDate()->format('Y-m-d'))); $dataMapper = new GenericDataMapper($articleTemplate, $outletTemplate, $this->getResourceManager('article'), $this->getResourceManager('author'), $this->getResourceManager('outlet')); $resourceId = $dataMapper->save(); if ($resourceId !== false) { $output->writeln(sprintf('<info>[+] %s - The article #%d was synchronized with successfully ...</info>', date('Y-m-d H:i:s'), $resourceId)); } else { $output->writeln(sprintf('<error>[+] %s - The article was not synchronized ...</error>', date('Y-m-d H:i:s'))); } return $resourceId; }