/**
  * @test
  */
 public function fetchItemsGetsMatchingItemsFromFeed()
 {
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setFeedUrl('file://' . __DIR__ . '/../../Fixtures/Feeds/news.typo3.org-news-teams-flow3-rss.xml');
     $channel->setName('Test Feed');
     $channel->setUrl('http://www.example.com/test');
     $this->channelRepository->add($channel);
     $this->channelService->fetchItems($channel);
     $this->assertEquals(10, count($channel->getItems()), 'Should fetch all 10 items from feed');
 }
 /**
  * Create some test data
  *
  * @return void
  */
 protected function createTestData()
 {
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('Test channel');
     $channel->setUrl('http://www.example.com');
     $channel->setFeedUrl('http://www.example.com/rss.xml');
     $this->channelRepository->add($channel);
     $item = new \Planetflow3\Domain\Model\Item();
     $item->setChannel($channel);
     $item->setAuthor('Test author');
     // $item->setCategories(array('FLOW3'));
     $item->setTitle('A test post');
     $item->setContent('My random content');
     $item->setDescription('Some description');
     $item->setLanguage('en');
     $item->setLink('http://www.example.com/posts/2');
     $item->setPublicationDate(new \DateTime('2011-10-09 08:07:06'));
     $item->setUniversalIdentifier('http://www.example.com/posts/2');
     $this->itemRepository->add($item);
 }
 /**
  * Create sample data
  *
  * @return void
  */
 public function sampleDataCommand()
 {
     $this->itemRepository->removeAll();
     $this->channelRepository->removeAll();
     $this->categoryRepository->removeAll();
     $flow3Category = new \Planetflow3\Domain\Model\Category('FLOW3');
     $this->categoryRepository->add($flow3Category);
     $phpCategory = new \Planetflow3\Domain\Model\Category('PHP');
     $this->categoryRepository->add($phpCategory);
     $phoenixCategory = new \Planetflow3\Domain\Model\Category('Phoenix');
     $this->categoryRepository->add($phoenixCategory);
     $channels = array();
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('news.typo3.org: FLOW3');
     $channel->setUrl('http://news.typo3.org/news/teams/flow3/');
     $channel->setFeedUrl('http://news.typo3.org/news/teams/flow3/rss.xml');
     $channel->setDefaultCategory($flow3Category);
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('Karsten Dambekalns - Code & Content');
     $channel->setUrl('http://blog.k-fish.de');
     $channel->setFeedUrl('http://blog.k-fish.de/feeds/posts/default');
     $channel->setFetchedCategories(array('PHP', 'FLOW3'));
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('networkteam Blog - FLOW3');
     $channel->setUrl('http://www.networkteam.com/blog.html');
     $channel->setFeedUrl('http://www.networkteam.com/rss.xml');
     $channel->setFilter('FLOW3');
     $channel->setDefaultCategory($flow3Category);
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('Robert Lemke - Fluent Code Artisan');
     $channel->setUrl('http://robertlemke.de/blog/');
     $channel->setFeedUrl('http://robertlemke.de/blog/feeds/posts.rss.xml');
     $channel->setFilter('FLOW3,PHP');
     $channel->setDefaultCategory($flow3Category);
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('t3blog.de');
     $channel->setUrl('http://t3blog.de');
     $channel->setFeedUrl('http://t3blog.de/feed/');
     $channel->setFilter('FLOW3');
     $channel->setDefaultCategory($flow3Category);
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $channel = new \Planetflow3\Domain\Model\Channel();
     $channel->setName('layh.com');
     $channel->setUrl('http://www.layh.com');
     $channel->setFeedUrl('http://www.layh.com/wordpress/feed/');
     $channel->setFetchedCategories(array('FLOW3'));
     $this->channelRepository->add($channel);
     $channels[] = $channel;
     $this->outputLine('Created default categories and channels');
 }