Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing the user to change default mock generator behaviour #79

Closed
mageekguy opened this issue Jun 22, 2012 · 0 comments
Closed

Allowing the user to change default mock generator behaviour #79

mageekguy opened this issue Jun 22, 2012 · 0 comments

Comments

@mageekguy
Copy link
Contributor

By default, a mock has the same interface and the same behavior than it's model, that is to say if foo::bar() return true, \mock\foo::bar() return true too.
It must be interesting to allow the user to change this, i.e. a call to \mock\foo::bar() return by default null instead of true.
The idea is to define \mageekguy\atoum\mock\generator::mockAllMethods() and \mageekguy\atoum\mock\generator::notMockAllMethods() to do that :

<?php

public function testSomething()
{
   /* ... */
   $this->mockGenerator->mockAllMethods();
   $mock = new \mock\foo();
   var_dump($mock->bar(); // NULL

   $this->mockGenerator->notMockAllMethods();
   $otherMock = new \mock\foo();
   var_dump($otherMock->bar(); // TRUE
   /* ... */
} 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant