Example #1
0
 public function testSave()
 {
     $config = array('username' => 'tic', 'password' => 'toc');
     $this->repository->expects($this->once())->method('findBy')->with($this->equalTo(array('type' => 'reuters', 'config' => $config)));
     $this->odm->expects($this->once())->method('persist')->with($this->isInstanceOf('Newscoop\\News\\ReutersFeed'));
     $this->odm->expects($this->once())->method('flush');
     $feed = $this->service->save(array('type' => 'reuters', 'config' => $config));
     $this->assertInstanceOf('Newscoop\\News\\ReutersFeed', $feed);
 }
Example #2
0
 public function testUpdateAfter7Days()
 {
     $settingsService = new SettingsService($this->odm);
     $itemService = new ItemService($this->odm, $settingsService);
     $updated = new \ReflectionProperty($this->feed, 'updated');
     $updated->setAccessible(true);
     $updated->setValue($this->feed, new \DateTime('-8 day'));
     $this->odm->persist($this->feed);
     $this->odm->flush();
     $this->feed->update($this->odm, $itemService);
 }