Skip to content

Commit ab0dd99

Browse files
committed
Support shouldNotReceive
This fixes the issue when using: ``` $this->fooMock->shouldNotReceive('doFoo')->andReturn('bar'); // Call to an undefined method Mockery\ExpectationInterface|Mockery\HigherOrderMessage::andReturn() ``` Fixes #11
1 parent ebf744d commit ab0dd99

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

stubs/MockInterface.stub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ interface MockInterface
1111
*/
1212
public function shouldReceive(...$methodNames);
1313

14+
/**
15+
* @param string|array<string, mixed> ...$methodNames
16+
* @return Expectation
17+
*/
18+
public function shouldNotReceive(...$methodNames);
19+
1420
/**
1521
* @return static
1622
*/
@@ -27,6 +33,12 @@ interface LegacyMockInterface
2733
*/
2834
public function shouldReceive(...$methodNames);
2935

36+
/**
37+
* @param string|array<string, mixed> ...$methodNames
38+
* @return Expectation
39+
*/
40+
public function shouldNotReceive(...$methodNames);
41+
3042
/**
3143
* @return static
3244
*/

tests/Mockery/MockeryBarTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace PHPStan\Mockery;
44

5-
class MockeryBarTest extends \PHPUnit\Framework\TestCase
5+
use Mockery\Adapter\Phpunit\MockeryTestCase;
6+
7+
class MockeryBarTest extends MockeryTestCase
68
{
79

810
/** @var \Mockery\MockInterface|Foo */
@@ -34,4 +36,9 @@ public function testExpectationMethodsAreCalled(): void
3436
self::assertSame('foo', $bar->doFoo());
3537
}
3638

39+
public function testShouldNotReceive(): void
40+
{
41+
$this->fooMock->shouldNotReceive('doFoo')->andReturn('bar');
42+
}
43+
3744
}

0 commit comments

Comments
 (0)