File tree 3 files changed +29
-5
lines changed
3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -20,4 +20,4 @@ cs-fix:
20
20
21
21
.PHONY : phpstan
22
22
phpstan :
23
- php vendor/bin/phpstan analyse -l 8 -c phpstan.neon src tests
23
+ php vendor/bin/phpstan analyse -l 9 -c phpstan.neon src tests
Original file line number Diff line number Diff line change @@ -39,6 +39,20 @@ interface LegacyMockInterface
39
39
*/
40
40
public function shouldNotReceive(...$methodNames);
41
41
42
+ /**
43
+ * @param null|string $method
44
+ * @param null|array<string> $args
45
+ * @return Expectation
46
+ */
47
+ public function shouldHaveReceived($method, $args = null);
48
+
49
+ /**
50
+ * @param null|string $method
51
+ * @param null|array<string> $args
52
+ * @return Expectation
53
+ */
54
+ public function shouldNotHaveReceived($method, $args = null);
55
+
42
56
/**
43
57
* @return static
44
58
*/
Original file line number Diff line number Diff line change @@ -40,17 +40,27 @@ public function testExpectationMethodsAreCalled(): void
40
40
self ::assertSame ('foo ' , $ bar ->doFoo ());
41
41
}
42
42
43
- public function testShouldNotReceiveAndHaveReceived (): void
43
+ public function testShouldNotReceive (): void
44
44
{
45
45
$ this ->fooMock ->shouldNotReceive ('doFoo ' )->andReturn ('bar ' );
46
- $ this ->fooMock ->shouldNotHaveReceived ('doFoo ' );
47
46
}
48
47
49
- public function testShouldReceiveAndHaveReceived (): void
48
+ public function testShouldReceive (): void
50
49
{
51
50
$ this ->fooMock ->shouldReceive ('doFoo ' )->andReturn ('bar ' );
52
51
self ::assertSame ('bar ' , $ this ->fooMock ->doFoo ());
53
- $ this ->fooMock ->shouldHaveReceived ('doFoo ' );
52
+ }
53
+
54
+ public function testShouldNotHaveReceived (): void
55
+ {
56
+ $ this ->fooMock ->shouldNotHaveReceived (null )->withArgs (['bar ' ]);
57
+ }
58
+
59
+ public function testShouldHaveReceived (): void
60
+ {
61
+ $ this ->fooMock ->allows ('doFoo ' )->andReturn ('bar ' );
62
+ self ::assertSame ('bar ' , $ this ->fooMock ->doFoo ());
63
+ $ this ->fooMock ->shouldHaveReceived ('doFoo ' )->once ();
54
64
}
55
65
56
66
}
You can’t perform that action at this time.
0 commit comments