Re: SKIPIF print vs die
| From: | Greg Beaver | Date: | Tue, 28 Apr 2009 17:30:33 +0000 |
| Subject: | Re: SKIPIF print vs die | ||
| References: | 1 2 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-64814@lists.php.net to get a copy of this message | ||
zoe wrote:
> Daniel Convissor wrote:
>> Hi Folks:
>>
>> I'm reading up on .phpt's because I'll be giving a tutorial at New
>> York's test fest event.
>>
>> The SKIPIF section info at http://qa.php.net/write-test.php
>> uses print
>> 'skip whatever' rather than die('skip whatever'), which is commonly
>> used in actual tests. die() seems preferable since it will halt
>> undesirable execution when calling the .phpt file directly (as
>> discussed at the bottom of the write-test web page.
>>
> Yes, I see your point. From that point of view using die() is preferable.
>> I'm wondering what people think about this and whether write-test
>> needs tweaking.
>>
> I'll tweak it no one comes up with a counter argument.
I've had a few cases where die() was less desirable because I wanted to
be able to run the test even when it would fail, so I could step through
to fix things. In other cases, the SKIPIF was complex enough that it
would sometimes skip when it shouldn't.
Thus, I'd say use per-test criteria to determine which way is better.
Perhaps use
// use echo 'skip whatever'; if you want to be able to step through the
// test with a debugger no matter what
die('skip whatever');
to suggest the most commonly successful skipping method, but mention the
other.
Greg