Skip to content

Commit

Permalink
Closes #4735
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 19, 2021
1 parent a1c34bd commit fe06cbe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog-9.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes of the PHPUnit 9.5 release series are documented in this fil
### Fixed

* [#4720](https://github.com/sebastianbergmann/phpunit/issues/4720): PHPUnit does not verify its own PHP extension requirements
* [#4735](https://github.com/sebastianbergmann/phpunit/issues/4735): Automated return value generation does not work for stubbed methods that return `*|false`

## [9.5.6] - 2021-06-23

Expand Down
1 change: 1 addition & 0 deletions src/Framework/MockObject/Invocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public function generateReturnValue()
return 0;

case 'bool':
case 'false':
return false;

case 'array':
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/Framework/MockObject/MockObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,16 @@ public function testMethodThatReturnsIntOrFalseCanBeStubbed(): void
$this->assertSame(1, $i->returnsIntOrFalse());
}

/**
* @requires PHP 8
*/
public function testReturnValueCanBeAutomaticallyGeneratedForMethodThatReturnsIntOrFalse(): void
{
$i = $this->createStub(InterfaceWithMethodsThatDeclareBooleanReturnTypes::class);

$this->assertFalse($i->returnsIntOrFalse());
}

/**
* @requires PHP 8
*/
Expand Down

0 comments on commit fe06cbe

Please sign in to comment.