[Solar-talk] Solar Testing via external test library
Travis Swicegood
development at domain51.com
Mon Oct 16 10:39:41 PDT 2006
Mike Naberezny wrote:
> 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.
>
Point taken...
>> 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.
>
The test I was wanting to make would be the first test prior to setting
the include path. It would actually clear out the include_path, try an
include and expect the error, then reset the include_path back to what
the config was and test again expecting no error. It's just a sanity
environment test to make sure Solar can be included before diving into
the test and throwing a segfault because of a recursive loop.
-Travis
> For testing exceptions, you can catch them yourself and assert on the
> class/code/message, or you can use ExceptionTestCase.
>
Before it's done I'll probably end up with a Solar_Test_PHPUnit with a
custom exception assertion and my assert errors. Exception catching
will be especially big because that's how Solar handles all of its errors.
In general, it seems PHPUnit3 is favored here, so I can work with it.
Just wanted to bring up my thoughts on it after setting up some basic tests.
-Travis
More information about the solar-talk
mailing list