Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Backtracking on errors when methods is already set
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Struber authored and sebastianbergmann committed May 26, 2016
1 parent d96b6c3 commit 4b1e381
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/Framework/MockObject/MockBuilder.php
Expand Up @@ -177,16 +177,6 @@ public function getMockForTrait()
*/
public function setMethods($methods)
{
if ($this->methods !== []) {
throw new PHPUnit_Framework_MockObject_RuntimeException(
sprintf(
'Cannot call method "%s" after methods have already been set. Methods are: %s',
__FUNCTION__,
json_encode($this->methods)
)
);
}

$this->methods = $methods;

return $this;
Expand All @@ -201,16 +191,6 @@ public function setMethods($methods)
*/
public function setMethodsExcept(Array $methods = [])
{
if ($this->methods !== []) {
throw new PHPUnit_Framework_MockObject_RuntimeException(
sprintf(
'Cannot call method "%s" after methods have already been set. Methods are: %s',
__FUNCTION__,
json_encode($this->methods)
)
);
}

$this->methodsExcept = $methods;

$this->setMethods(array_diff($this->generator->getClassMethods($this->type), $this->methodsExcept));
Expand Down

0 comments on commit 4b1e381

Please sign in to comment.