forked from phpstan/phpstan-mockery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add handling for more complex declaration syntax:
- alias: - overload: - Multiple interface names - Constructor arguments - Method declaration
- Loading branch information
1 parent
0057dac
commit a013b23
Showing
6 changed files
with
139 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Mockery; | ||
|
||
interface Baz | ||
{ | ||
|
||
public function doFoo(): ?string; | ||
|
||
} |
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,10 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Mockery; | ||
|
||
interface Buzz | ||
{ | ||
|
||
public function doBuzz(): ?string; | ||
|
||
} |
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,33 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Mockery; | ||
|
||
/** | ||
* @runTestsInSeparateProcesses | ||
*/ | ||
class IsolatedMockeryTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
|
||
public function testAliasMock(): void | ||
{ | ||
$fooMock = \Mockery::mock('alias:' . Foo::class); | ||
$this->requireFoo($fooMock); | ||
|
||
$fooMock->shouldReceive('doFoo')->andReturn('bar'); | ||
self::assertSame('bar', $fooMock->doFoo()); | ||
} | ||
|
||
public function testOverloadMock(): void | ||
{ | ||
$fooMock = \Mockery::mock('overload:' . Foo::class); | ||
$this->requireFoo($fooMock); | ||
|
||
$fooMock->shouldReceive('doFoo')->andReturn('bar'); | ||
self::assertSame('bar', $fooMock->doFoo()); | ||
} | ||
|
||
private function requireFoo(Foo $foo): void | ||
{ | ||
} | ||
|
||
} |
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