Skip to content

Commit

Permalink
Merge pull request #5972 from GrahamCampbell/4.2-test-views
Browse files Browse the repository at this point in the history
[4.2] Fixed The View Tests
  • Loading branch information
taylorotwell committed Oct 4, 2014
2 parents e91ab6f + d251b39 commit e29253c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tests/View/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class ViewTest extends PHPUnit_Framework_TestCase {

public function __construct()
public function tearDown()
{
m::close();
}
Expand Down Expand Up @@ -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());
}
Expand All @@ -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);
Expand Down Expand Up @@ -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());
}


Expand Down

0 comments on commit e29253c

Please sign in to comment.