PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Testing » PHPUnit2 » Bug #7705

Multiple mocking of a class without all methods results in wrong caller statist

Details

Submitted2006-05-23 14:29 UTC
Fromkore at php dot net
Assignedsebastian
StatusClosed
PackagePHPUnit2
PHP Version5.1.4
OSLinux 2.6.16-gentoo-r3
Roadmaps(Not assigned)

Comments

[2006-05-23 14:29 UTC] kore at php dot net

Description:
------------
You need to specify all methods you want the calls to be checked at the first test you "mock" the class, otherwise the call count will stay 0 for all the following tests.

Call attached file with:
$ phpunit testMockedCalls double_mock_create.php

Test script:
---------------
Download test:
http://kore.phpugdo.de/double_mock_create.phps

Expected result:
----------------
PHPUnit 3.0.0alpha3 by Sebastian Bergmann.

..

Time: 00:00

OK (2 tests)

Actual result:
--------------
PHPUnit 3.0.0alpha3 by Sebastian Bergmann.

.F

Time: 00:00
There was 1 failure:
1) testSecond(testMockedCalls)
Expected invocation count for is wrong.
expected integer <1>
difference <1>
got integer <0>
/usr/lib/php/php5.1-cvs/bin/phpunit:40

FAILURES!
Tests: 2, Failures: 1.

[2006-05-31 13:00 UTC] sebastian at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.