-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mocking anonymous classes (#1415)
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
- Loading branch information
1 parent
d2fcf80
commit 6db8c48
Showing
4 changed files
with
96 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mockery\Tests\Unit\Regression; | ||
|
||
use Mockery; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Mockery | ||
* @see https://github.com/mockery/mockery/issues/1414 | ||
* @requires PHP 8.0 | ||
*/ | ||
final class Issue1414Test extends TestCase | ||
{ | ||
public function testMockAnonymousClass(): void | ||
{ | ||
$class = new class() extends \stdClass {}; | ||
|
||
$mock = Mockery::mock($class::class); | ||
|
||
self::assertInstanceOf($class::class, $mock); | ||
} | ||
} |