Re: SimpleTest?
Reply #2 –
I've been having trouble getting it running with Netbeans. No matter what I do, it seems to say that I have zero tests.
Re: SimpleTest?
Reply #5 –
Simple test has been good, but I do think we should consider the move to phpunit (assuming we can get it running) ... it seems better supported as a program and is used in several of the CI projects that we use as well (which simple test is not) Something to consider, that link makes it look easy to transfer over, maybe!
Re: SimpleTest?
Reply #6 –
I was quickly looking at phpunit, but I can't see how do tests on the generated webpages.
I'm probably missing something. somewhere.
Re: SimpleTest?
Reply #7 –
You want to do functional tests of the output?
Re: SimpleTest?
Reply #8 –
We are currently doing some, yes.
I don't know if they are always necessary or if we can live without.
Re: SimpleTest?
Reply #11 –
There are a few minor changes, but Copy&Paste is a good start. PHPUnit does have a richer set of assert statements as well which can/will be handy.
1) Extend PHPUnit_Framework_TestCase instead of UnitTestCase
2) Should never need SSI, any extra files you needs should just be the subs. You can include those in the setUp method
3) globals are backup by default in the .xml configs (which means each test that is run gets the original globals). If a subsequent test method relies on a updated global from a previous test method, then you can do one of two things
a) declare @backupGlobals disabled in the class level docblocks. (example is hooksTest)
b) get the value of the new global in the test method that sets it and pass it to the test method that needs it. Also use @depends test xyz in the doc block of the method that needs testxyz results.
4) A few asserts did change
assertEqual => assertEquals
assertNotEqual => assertNotEquals
assertPattern => assertRegExp
assertIdentical => assertSame
assertNotIdentical => assertNotSame
assertIsA => assertInstanceOf OR assertInternalType (like assertIsA($var, 'numeric'); => assertInternalType('numeric', $var);
$this->pass() => $this->assertTrue(true)