Skip to content

Instantly share code, notes, and snippets.

@scottdavis
Created July 1, 2009 20:50
Show Gist options
  • Save scottdavis/139048 to your computer and use it in GitHub Desktop.
Save scottdavis/139048 to your computer and use it in GitHub Desktop.
<?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