-- CatharsisJelly <[EMAIL PROTECTED]> wrote
(on Monday, 24 November 2008, 03:06 AM -0800):
> I'm using PHPUnit to test my models in ZF and came across a bit of an issue
> with it on Friday. So I have a Rowclass designated for a particular table
> class. Inside this row class I had made a syntax error that I didn't see and 
> it
> did something weird to my test suite.
> 
> Below is the output of PHPUnit for this particular test, first of all with the
> offending Rowclass commented out
> 
> C:\svn\framework-dev\html\tests>phpunit models\AssociationTest.php
> PHPUnit 3.3.3 by Sebastian Bergmann.
> 
> .I..I
> 
> Time: 1 second
> 
> OK, but incomplete or skipped tests!
> Tests: 5, Assertions: 7, Incomplete: 2.
> 
> And now with the offending code back in.
> 
> C:\svn\framework-dev\html\tests>phpunit models\AssociationTest.php
> PHPUnit 3.3.3 by Sebastian Bergmann.
> 
> No errors, no tests.. nothing. Now I'm not sure if this is the fault of PHP, 
> ZF
> or PHPUnit but it took me half a day to find it. As a warning any other coder
> that if this is happening to you you should check to see if you have a syntax
> error in your code somewhere. If anyone has an idea as to how this behaviour
> may be improved drop me a line, I'm going to alert the owner of PHPUnit to 
> this
> as well if at all possible but I think it's a ZF issue. Zend_Loader::loadClass
> not exceptioning on a badly included rowClass perhaps?

A couple things to note. First, when testing, make sure that
error_reporting is set to E_ALL|E_STRICT (8191), and that display_errors
is on; disabling errors when testing is a good way to waste a lot of
time.

Second, I've occasionally had issues with PHP segfaulting during
testing... and in such cases, there's little you can do except to begin
commenting out tests until you find the offending one.

Third, Zend_Loader::loadClass() will throw an exception if the requested
class or interface was not loaded. Again, if display_errors is on and
you have an appropriate error_reporting setting, you'll see this.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to