Skip to content

Commit acfb5b0

Browse files
committed
Add tests for shouldHaveReceived and shouldNotHaveReceived
1 parent ab0dd99 commit acfb5b0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/Mockery/MockeryBarTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class MockeryBarTest extends MockeryTestCase
1212

1313
protected function setUp(): void
1414
{
15+
parent::setUp();
16+
1517
$this->fooMock = \Mockery::mock(Foo::class);
1618
}
1719

@@ -36,9 +38,17 @@ public function testExpectationMethodsAreCalled(): void
3638
self::assertSame('foo', $bar->doFoo());
3739
}
3840

39-
public function testShouldNotReceive(): void
41+
public function testShouldNotReceiveAndHaveReceived(): void
4042
{
4143
$this->fooMock->shouldNotReceive('doFoo')->andReturn('bar');
44+
$this->fooMock->shouldNotHaveReceived('doFoo');
45+
}
46+
47+
public function testShouldReceiveAndHaveReceived(): void
48+
{
49+
$this->fooMock->shouldReceive('doFoo')->andReturn('bar');
50+
self::assertSame('bar', $this->fooMock->doFoo());
51+
$this->fooMock->shouldHaveReceived('doFoo');
4252
}
4353

4454
}

0 commit comments

Comments
 (0)