From 3869601379ec02547a727535327f5e8c64cee5f9 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Thu, 12 Oct 2017 10:27:27 +0200 Subject: [PATCH] Fix build (#1308) --- Tests/Controller/GalleryAdminControllerTest.php | 5 ++++- Tests/Controller/MediaAdminControllerTest.php | 14 ++++++++++---- Tests/Controller/MediaControllerTest.php | 9 +++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Tests/Controller/GalleryAdminControllerTest.php b/Tests/Controller/GalleryAdminControllerTest.php index 03041d411..f4781daf1 100644 --- a/Tests/Controller/GalleryAdminControllerTest.php +++ b/Tests/Controller/GalleryAdminControllerTest.php @@ -139,12 +139,15 @@ private function configureSetFormTheme($formView, $formTheme) private function configureRender($template, $data, $rendered) { $templating = $this->prophesize('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); + $response = $this->prophesize('Symfony\Component\HttpFoundation\Response'); $pool = $this->prophesize('Sonata\MediaBundle\Provider\Pool'); $this->admin->getPersistentParameters()->willReturn(array('param' => 'param')); $this->container->has('templating')->willReturn(true); $this->container->get('templating')->willReturn($templating->reveal()); $this->container->get('sonata.media.pool')->willReturn($pool->reveal()); - $templating->renderResponse($template, $data, null)->willReturn($rendered); + $response->getContent()->willReturn($rendered); + $templating->renderResponse($template, $data, null)->willReturn($response->reveal()); + $templating->render($template, $data)->willReturn($rendered); } } diff --git a/Tests/Controller/MediaAdminControllerTest.php b/Tests/Controller/MediaAdminControllerTest.php index 5b82ba2b5..362d27b30 100644 --- a/Tests/Controller/MediaAdminControllerTest.php +++ b/Tests/Controller/MediaAdminControllerTest.php @@ -59,7 +59,8 @@ public function testCreateActionToSelectProvider() $response = $this->controller->createAction($this->request->reveal()); - $this->assertSame('renderResponse', $response); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); + $this->assertSame('renderResponse', $response->getContent()); } public function testCreateAction() @@ -72,7 +73,8 @@ public function testCreateAction() $response = $this->controller->createAction($this->request->reveal()); - $this->assertSame('renderResponse', $response); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); + $this->assertSame('renderResponse', $response->getContent()); } public function testListAction() @@ -115,7 +117,8 @@ public function testListAction() $response = $this->controller->listAction($this->request->reveal()); - $this->assertSame('renderResponse', $response); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); + $this->assertSame('renderResponse', $response->getContent()); } private function configureCRUDController() @@ -216,12 +219,15 @@ private function configureSetCsrfToken($intention) private function configureRender($template, $data, $rendered) { $templating = $this->prophesize('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); + $response = $this->prophesize('Symfony\Component\HttpFoundation\Response'); $pool = $this->prophesize('Sonata\MediaBundle\Provider\Pool'); $this->admin->getPersistentParameters()->willReturn(array('param' => 'param')); $this->container->has('templating')->willReturn(true); $this->container->get('templating')->willReturn($templating->reveal()); $this->container->get('sonata.media.pool')->willReturn($pool->reveal()); - $templating->renderResponse($template, $data, null)->willReturn($rendered); + $response->getContent()->willReturn($rendered); + $templating->renderResponse($template, $data, null)->willReturn($response->reveal()); + $templating->render($template, $data)->willReturn($rendered); } } diff --git a/Tests/Controller/MediaControllerTest.php b/Tests/Controller/MediaControllerTest.php index a26272258..19c4a9b6f 100644 --- a/Tests/Controller/MediaControllerTest.php +++ b/Tests/Controller/MediaControllerTest.php @@ -119,7 +119,8 @@ public function testViewActionRendersView() $response = $this->controller->viewAction(1, 'format'); - $this->assertSame('renderResponse', $response); + $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); + $this->assertSame('renderResponse', $response->getContent()); } private function configureDownloadSecurity($pool, $media, $request, $isGranted) @@ -162,9 +163,13 @@ private function configureGetCurrentRequest($request) private function configureRender($template, $data, $rendered) { $templating = $this->prophesize('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); + $response = $this->prophesize('Symfony\Component\HttpFoundation\Response'); + $pool = $this->prophesize('Sonata\MediaBundle\Provider\Pool'); $this->container->has('templating')->willReturn(true); $this->container->get('templating')->willReturn($templating->reveal()); - $templating->renderResponse($template, $data, null)->willReturn($rendered); + $response->getContent()->willReturn($rendered); + $templating->renderResponse($template, $data, null)->willReturn($response->reveal()); + $templating->render($template, $data)->willReturn($rendered); } }