Commit f266a1c6 authored by Taylor Otwell's avatar Taylor Otwell

added view tests.

parent ca3c6623
<?php
class ViewTest extends PHPUnit_Framework_TestCase {
public function testConstructorSetsViewNameAndData()
{
$view = new System\View('view', array('name' => 'test'));
$this->assertEquals($view->view, 'view');
$this->assertEquals($view->data, array('name' => 'test'));
$view = new System\View('view');
$this->assertEquals($view->data, array());
}
public function testMakeMethodReturnsNewViewInstance()
{
$this->assertInstanceOf('System\\View', System\View::make('test'));
}
public function testBindMethodAddsItemToViewData()
{
$view = System\View::make('test')->bind('name', 'test');
$this->assertEquals($view->data, array('name' => 'test'));
}
public function testBoundViewDataCanBeRetrievedThroughMagicMethods()
{
$view = System\View::make('test')->bind('name', 'test');
$this->assertTrue(isset($view->name));
$this->assertEquals($view->name, 'test');
unset($view->name);
$this->assertFalse(isset($view->name));
}
public function testGetMethodReturnsStringContentOfView()
{
$this->assertTrue(is_string(System\View::make('home/index')->get()));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment