コード例 #1
0
 public function let(NewsInterface $repository, NewsFactory $factory)
 {
     $repository->getById(null)->willReturn(new NewsEntity());
     $repository->getById('non_existing')->willReturn(false);
     $repository->remove(Argument::any())->willReturn(true);
     $this->beConstructedWith($repository, $factory);
 }
コード例 #2
0
 public function let(NewsInterface $repository, NewsFactory $factory)
 {
     $article_to_save = new NewsEntity();
     $factory->newsEntity(array())->willReturn($article_to_save);
     $non_existing_article = new NewsEntity();
     $non_existing_article->setId('non_existing');
     $factory->newsEntity(array('name' => 'fails'))->willReturn($non_existing_article);
     $repository->getById(null)->willReturn(true);
     $repository->getById('non_existing')->willReturn(false);
     $repository->save(Argument::any())->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
コード例 #3
0
ファイル: NewNewsSpec.php プロジェクト: collegefb/collegefb
 public function let(NewsInterface $repository, NewsFactory $factory)
 {
     $news_to_save = new NewsEntity();
     $factory->newsEntity(array())->willReturn($news_to_save);
     $news_to_save_that_fails = new NewsEntity();
     $news_to_save_that_fails->setLink('fails');
     $factory->newsEntity(array('link' => 'fails'))->willReturn($news_to_save_that_fails);
     $repository->getByLink(null)->willReturn(false);
     $repository->getByLink('fails')->willReturn(false);
     $repository->save($news_to_save)->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
コード例 #4
0
ファイル: ListNewsSpec.php プロジェクト: collegefb/collegefb
 public function let(NewsInterface $repository, NewsFactory $factory)
 {
     $repository->listAll(0, 25)->willReturn(new NewsIterator(array(1, 2)));
     $repository->setQueryParams(Argument::any(), Argument::any())->willReturn(true);
     $this->beConstructedWith($repository, $factory);
 }