PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Testing » PHPUnit2 » Bug #7887

Mocking interfaces

Details

Request #7887Mocking interfaces
Submitted2006-06-13 15:13 UTC
FromJared dot Williams1 at ntlworld dot com
StatusClosed
PackagePHPUnit2
PHP VersionIrrelevant
OSWin2000
Roadmaps(Not assigned)

Comments

[2006-06-13 15:13 UTC] Jared dot Williams1 at ntlworld dot com

Description:
------------
When generating a mock based on an interface, all methods of the interface should be mocked.

Fatal error: Class Mock_ContentStore_f248c6fb contains 1 abstract method and must therefore be declared abstract or implement the remaining method
s (ContentStore::open) in \PEAR\PHPUnit2\Extensions\MockObject\Mock.php(145) : eval()'d code on line 28

I would think this could make testing more less brittle as adding a method to an interface wouldn't break all existing tests using it.

[2006-06-29 12:26 UTC] maxx dot gass at googlemail dot com

Mocking interfaces is already possible in CVS.

[2006-06-29 12:27 UTC] sebastian at php dot net

Closing per previous comment.