[Solar-talk] Solar Testing via external test library

Mike Naberezny mike at naberezny.com
Mon Oct 16 09:49:08 PDT 2006


Travis Swicegood wrote:
>> If we do proceed with an external library, I prefer PHPUnit3 for one  
>> main reason:  it is already E_STRICT compliant.
> 
> Fair enough point, although I don't know if I would consider it that big 
> of a deal.

One of the Solar requirements is that it be E_STRICT compliant.  You can't 
test it with a framework that isn't E_STRICT compliant because your results 
will be full of warnings from the harness.

> I did so some basic testing with PHPUnit3, started on some of the Solar 
> methods.  I ran into some limitations though in doing a SolarEnvironment 
> test as I specifically need to be able to test for expected PHP errors.  
> I can write my own assertError(), but I already knew that SimpleTest had 
> it so I wanted to float the idea.

Solar's standard is to always throw exceptions and never trigger PHP errors. 
You should not be asserting that Solar will trigger_error() because it should 
never.  If a PHP error does get raised for another reason, PHPUnit will report 
the test result as Error and the code should be fixed to not leak it.

For testing exceptions, you can catch them yourself and assert on the 
class/code/message, or you can use ExceptionTestCase.

http://www.phpunit.de/pocket_guide/2.3/en/testing-exceptions-and-performance-regressions.html

Regards,
Mike


More information about the solar-talk mailing list