forked from bastos/nicedog
Unit Testing
johnbintz edited this page Sep 13, 2010
·
2 revisions
Unit testing is done using PHPUnit and the NimblePHPUnitTestCase class:
<?php require_once('nimble/lib/test/phpunit_testcase.php'); require_once('path/to/my/controller.php'); class ControllerTest extends NimblePHPUnitTestCase { function testMyIndexMethod() { $controller = new MyController(); $source = $this->render($controller, "index", "index/index.php"); $this->assertFalse(empty($source)); $this->assertValidXHTML($source); foreach (array( '//title' => 'My Cool Website', '//h1' => 'Welcome to My Cool Website', '//a[@id="home"]' => false, '//a[@id="subpage"]' => true ) as $xpath => $value) { $this->assertXpath($source, $xpath, $return); } } } ?>