Skip to content

Commit

Permalink
Stubbed templating
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjmit committed Aug 16, 2013
1 parent 8ab17a2 commit c397914
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions spec/Peterjmit/BlogBundle/Controller/BlogControllerSpec.php
Expand Up @@ -11,16 +11,21 @@
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ObjectRepository;

use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;

class BlogControllerSpec extends ObjectBehavior
{
function let(
ContainerInterface $container,
ManagerRegistry $registry,
ObjectManager $manager,
ObjectRepository $repository
ObjectRepository $repository,
EngineInterface $templating
) {
$container->has('doctrine')->willReturn(true);
$container->get('doctrine')->willReturn($registry);
$container->get('templating')->willReturn($templating);

$registry->getManager()->willReturn($manager);
$manager->getRepository('PeterjmitBlogBundle:Blog')->willReturn($repository);
Expand All @@ -33,10 +38,22 @@ function it_is_initializable()
$this->shouldHaveType('Peterjmit\BlogBundle\Controller\BlogController');
}

function it_should_respond_to_index_action(ObjectRepository $repository)
{
function it_should_respond_to_index_action(
ObjectRepository $repository,
EngineInterface $templating,
Response $mockResponse
) {
$repository->findAll()->willReturn(array());

$templating
->renderResponse(
'PeterjmitBlogBundle:Blog:index.html.twig',
array('posts' => array()),
null
)
->willReturn($mockResponse)
;

$response = $this->indexAction();

$response->shouldHaveType('Symfony\Component\HttpFoundation\Response');
Expand Down

0 comments on commit c397914

Please sign in to comment.