Re: [VOTE] Expectations
| From: | Patrick Schaaf | Date: | Sat, 28 Feb 2015 19:08:10 +0000 |
| Subject: | Re: [VOTE] Expectations | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84083@lists.php.net to get a copy of this message | ||
Am 28.02.2015 19:32 schrieb "Crypto Compress" <cryptocompress@googlemail.com
>:
>
> class BankAccount {
> function Add($amount) {
> assert($amount > 0);
> // ... code block ...
> }
> }
>
> Now the programmer implementing "code block" to gracefully handle $amount
> 0 has a problem. There is no way to (Unit)test failing path on
development machine. Code after assertion is never called for failing
contitions. What to do?
Put the assert AFTER handling the always-to-be-done validation, of course.
Doesn't make sense otherwise.
Patrick