From d251b39d3cd2cda313fcab5abccf1b8aa2e8b0f0 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Sat, 4 Oct 2014 17:34:54 +0100 Subject: [PATCH] Fixed the view tests --- tests/View/ViewTest.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/View/ViewTest.php b/tests/View/ViewTest.php index 5492009d1509..6bcdcce27c5b 100755 --- a/tests/View/ViewTest.php +++ b/tests/View/ViewTest.php @@ -6,7 +6,7 @@ class ViewTest extends PHPUnit_Framework_TestCase { - public function __construct() + public function tearDown() { m::close(); } @@ -58,7 +58,6 @@ public function testRenderSectionsReturnsEnvironmentSections() )); $view->shouldReceive('render')->with(m::type('Closure'))->once()->andReturn($sections = array('foo' => 'bar')); - $view->getFactory()->shouldReceive('getSections')->once()->andReturn($sections); $this->assertEquals($sections, $view->renderSections()); } @@ -67,12 +66,12 @@ public function testRenderSectionsReturnsEnvironmentSections() public function testSectionsAreNotFlushedWhenNotDoneRendering() { $view = $this->getView(); - $view->getFactory()->shouldReceive('incrementRender')->once(); - $view->getFactory()->shouldReceive('callComposer')->once()->with($view); - $view->getFactory()->shouldReceive('getShared')->once()->andReturn(array('shared' => 'foo')); - $view->getEngine()->shouldReceive('get')->once()->with('path', array('foo' => 'bar', 'shared' => 'foo'))->andReturn('contents'); - $view->getFactory()->shouldReceive('decrementRender')->once(); - $view->getFactory()->shouldReceive('flushSectionsIfDoneRendering')->once(); + $view->getFactory()->shouldReceive('incrementRender')->twice(); + $view->getFactory()->shouldReceive('callComposer')->twice()->with($view); + $view->getFactory()->shouldReceive('getShared')->twice()->andReturn(array('shared' => 'foo')); + $view->getEngine()->shouldReceive('get')->twice()->with('path', array('foo' => 'bar', 'shared' => 'foo'))->andReturn('contents'); + $view->getFactory()->shouldReceive('decrementRender')->twice(); + $view->getFactory()->shouldReceive('flushSectionsIfDoneRendering')->twice(); $this->assertEquals('contents', $view->render()); $this->assertEquals('contents', (string) $view); @@ -166,7 +165,7 @@ public function testViewGatherDataWithRenderable() $view->renderable = m::mock('Illuminate\Support\Contracts\RenderableInterface'); $view->renderable->shouldReceive('render')->once()->andReturn('text'); - $view->render(); + $this->assertEquals('contents', $view->render()); }