Example #1
0
 /**
  * @test
  */
 public function findByDelegates()
 {
     $param = new FileFinder();
     $expected = 'tus';
     $this->repo->findBy($param)->shouldBeCalled()->willReturn($expected);
     $ret = $this->filelib->getFileRepository()->findBy($param);
     $this->assertEquals($expected, $ret);
 }
 /**
  * Test getPublishedFeaturedPosts.
  */
 public function testGetPublishedLatestPosts()
 {
     $postService = $this->createPostService();
     $this->postRepositoryDouble->findBy(['state' => Post::STATE_PUBLISHED], ['date' => 'desc'])->willReturn([new Post(), new Post()]);
     $posts = $postService->getPublishedLatestPosts();
     $this->assertTrue(2 == count($posts));
     $posts = $postService->getPublishedLatestPosts(1);
     $this->assertTrue(1 == count($posts));
     $posts = $postService->getPublishedLatestPosts(2);
     $this->assertTrue(2 == count($posts));
     $posts = $postService->getPublishedLatestPosts(3);
     $this->assertTrue(2 == count($posts));
     $this->assertInstanceOf('Prh\\BlogBundle\\Entity\\Post', $posts[0]);
 }