Skip to content

Commit 6d8eb69

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 6d8eb69

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ public function testExpectationMethodsAreCalled(): void
3434
self::assertSame('foo', $bar->doFoo());
3535
}
3636

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

0 commit comments

Comments
 (0)