Created
July 1, 2009 20:50
-
-
Save scottdavis/139048 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package functional_test | |
* */ | |
require_once('nimble/lib/test/phpunit_testcase.php'); | |
class TaskControllerTest extends NimblePHPFunctonalTestCase { | |
public function setUp() { | |
} | |
public function testLoadIndex() { | |
$this->get('index', array(), array(), array('user_id' => User::find('first')->id)); | |
$this->assertContentType('text/html'); | |
$this->assertTemplate('index'); | |
$this->responseIncludes('<table'); | |
$this->assertXpath('div[id=projects]'); | |
$this->assertXpathNodes('div[id=projects]', 1); | |
$tasks = $this->assigns('tasks'); | |
foreach($tasks as $task) { | |
$this->assertTrue($task->isValid()); | |
} | |
} | |
public function testNotLoggedInTryToLoadIndex() { | |
$this->get('index'); | |
$this->assertRedirect('/'); | |
$this->assertContentType('text/html'); | |
} | |
public function testShowTask() { | |
$task = Task::find('first'); | |
$this->get('show', array($task->id), array(), array('user_id' => User::find('first')->id)); | |
$this->assertContentType('text/html'); | |
$this->assertTemplate('show'); | |
$this->assertXpathValue('h1', "Todo:" . $task->title); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment