Skip to content

Commit

Permalink
Switch deprecated setMethods to onlyMethods
Browse files Browse the repository at this point in the history
  • Loading branch information
dafeder committed Aug 20, 2021
1 parent 367152e commit 9d31c4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ Creating a double for the body object with plain phpunit might look like this:
```php
$organ = $this->getMockBuilder(Organ::class)
->disableOriginalConstructor()
->setMethods(['getName'])
->onlyMethods(['getName'])
->getMock();

$organ->method('getName')->willReturn('brain');

$system = $this->getMockBuilder(System::class)
->disableOriginalConstructor()
->setMethods(['getOrgan'])
->onlyMethods(['getOrgan'])
->getMock();

$system->method('getOrgan')->willReturn($organ);

$body = $this->getMockBuilder(Body::class)
->disableOriginalConstructor()
->setMethods(['getSystem'])
->onlyMethods(['getSystem'])
->getMock();

$body->method('getSystem')->willReturn($system);
Expand Down
2 changes: 1 addition & 1 deletion src/Chain.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private function build($objectClass)
$builder = $this->getBuilder($objectClass);

if (!empty($methods)) {
$builder->setMethods($methods);
$builder->onlyMethods($methods);
}
$mock = $builder->getMockForAbstractClass();

Expand Down

0 comments on commit 9d31c4d

Please sign in to comment.