summaryrefslogtreecommitdiffstats
path: root/tests/View/TwigTest.php
diff options
context:
space:
mode:
authorminstel <minstel@yandex.ru>2016-10-25 14:46:05 +0300
committerminstel <minstel@yandex.ru>2016-10-25 14:46:05 +0300
commitb8540d92944123d15559f9033f523f9f6c5126ec (patch)
tree92d5e71c1e4d54a7727b29ae18f44f09965cad2a /tests/View/TwigTest.php
parent34d3ddc178ca066fc534ceec7f37e393813d22fc (diff)
downloadcontroller-b8540d92944123d15559f9033f523f9f6c5126ec.zip
controller-b8540d92944123d15559f9033f523f9f6c5126ec.tar.gz
controller-b8540d92944123d15559f9033f523f9f6c5126ec.tar.bz2
Flash
Diffstat (limited to 'tests/View/TwigTest.php')
-rw-r--r--tests/View/TwigTest.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/View/TwigTest.php b/tests/View/TwigTest.php
index 2792a03..662681d 100644
--- a/tests/View/TwigTest.php
+++ b/tests/View/TwigTest.php
@@ -1,5 +1,6 @@
<?php
+use Jasny\Flash;
use Jasny\Controller\View\Twig;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
@@ -16,7 +17,7 @@ class TwigTest extends PHPUnit_Framework_TestCase
*/
public function testGetTwig()
{
- $view = $this->getView(['getTwigLoader', 'getTwigEnvironment', 'createTwigFunction', 'createTwigFilter', 'setViewExtension']);
+ $view = $this->getView(['getTwigLoader', 'getTwigEnvironment', 'createTwigFunction', 'createTwigFilter', 'setViewExtension', 'setViewVariable']);
list($request, $response) = $this->getRequests();
list($loader, $env) = $this->getTwigObjects();
@@ -32,7 +33,12 @@ class TwigTest extends PHPUnit_Framework_TestCase
$view->expects($this->once())->method('getRequest')->will($this->returnValue($request));
$request->expects($this->once())->method('getUri')->will($this->returnValue($uri));
$uri->expects($this->once())->method('getPath')->will($this->returnValue($path));
- $env->expects($this->once())->method('addGlobal')->with($this->equalTo('current_url'), $this->equalTo($path));
+ $view->expects($this->exactly(2))->method('setViewVariable')->withConsecutive(
+ [$this->equalTo('current_url'), $this->equalTo($path)],
+ [$this->equalTo('flash'), $this->callback(function($flash) {
+ return $flash instanceof Flash && empty($flash->get());
+ })]
+ );
$result = $view->getTwig();
$resultSaved = $view->getTwig();