r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Dec 02 '15

[deleted]

42

u/[deleted] Dec 02 '15

The cURL extension is a thin wrapper around the library. Mocking the precise feature you're testing means you're not testing anything. Mocks exist to replace dependencies which are not part of the tested component's responsibility, but are required by it. In this case the responsibility of the cURL extension is to communicate with the actual cURL library.

Sometimes it's better to have test errors, than to have a cargo cult test suite that runs perfectly and tests nothing.

13

u/[deleted] Dec 02 '15

The cURL extension is a thin wrapper around the library

So it should be really simple to test, without needing to actually call cURL. There is no excuse for a test suite that calls out to network resources.

7

u/estarra Dec 02 '15

There is no excuse for a test suite that calls out to network resources.

For unit tests, sure. For functional tests, you test whatever your code is supposed to be doing: network calls, db fetches, etc...

→ More replies (5)