CodeIgniter and SimpleTest -- How to make my first test?
Posted
by Smandoli
on Stack Overflow
See other posts from Stack Overflow
or by Smandoli
Published on 2010-05-16T20:26:17Z
Indexed on
2010/05/16
20:30 UTC
Read the original article
Hit count: 238
I'm used to web development using LAMP, PHP5, MySQL plus NetBeans with Xdebug.
Now I want to improve my development, by learning how to use (A) proper testing and (B) a framework. So I have set up CodeIgniter, SimpleTest and the easy Xdebug add-in for Firefox. This is great fun because maroonbytes provided me with clear instructions and a configured setup ready for download. I am standing on the shoulders of giants, and very grateful.
I've used SimpleTest a bit in the past. Here is a the kind of thing I wrote:
<?php
require_once('../simpletest/unit_tester.php');
require_once('../simpletest/reporter.php');
class TestOfMysqlTransaction extends UnitTestCase {
function testDB_ViewTable() {
$this->assertEqual(1,1); // a pseudo-test
}
}
$test = new TestOfMysqlTransaction();
$test->run(new HtmlReporter())
?>
So I hope I know what a test looks like. What I can't figure out is where and how to put a test in my new setup. I don't see any sample tests in the maroonbytes package, and Google so far has led me to posts that assume unit testing is already functionally available. What do I do?
© Stack Overflow or respective owner