#68 Add ability for a mock to fail all other function calls

open
nobody
None
5
2009-11-11
2009-11-11
No

When you specify an expectation such as expectOnce(), it would be nice to be able to tell the mock to fail during tally() if any other functions without specified call count expectations are called during the test.

function testFoo() {
$mock = new MockFoo();
$mock->expectOnce('bar');
$mock->failOtherCalls(); <-- disallow all other function calls

$mock->bar();
$mock->baz(); <-- not expected

$mock->tally(); <-- fail!
}

I personally feel this should be the default behavior, but that would break a lot of tests.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks