File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -36,4 +36,15 @@ public function seeMockRequestWasNotCalled(string $expectationId): void
3636 $ this ->seeMockRequestWasCalled ($ expectationId , 0 );
3737 }
3838
39+ public function resetMockServerLogs ()
40+ {
41+ $ request = new Request ('PUT ' , '/mockserver/clear?type=log ' );
42+ $ response = $ this ->mockserverClient ->sendRequest ($ request );
43+ Assert::assertEquals (
44+ 200 ,
45+ $ response ->getStatusCode (),
46+ $ response ->getBody ()->getContents ()
47+ );
48+
49+ }
3950}
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ protected function setUp(): void
1717 parent ::setUp ();
1818 $ this ->sot = new MockServerHelper ();
1919 $ this ->client = new Client (['proxy ' => 'http://mockserver:1080 ' , 'verify ' => false ]);
20+ $ this ->sot ->resetMockServerLogs ();
2021 }
2122
2223 public function testExpectationWasCalled (): void
@@ -25,6 +26,13 @@ public function testExpectationWasCalled(): void
2526 $ this ->sot ->seeMockRequestWasCalled ('get-post-1 ' );
2627 }
2728
29+ public function testExpectationWasCalledExact (): void
30+ {
31+ $ this ->client ->request ('GET ' , 'https://jsonplaceholder.typicode.com/posts/1 ' );
32+ $ this ->client ->request ('GET ' , 'https://jsonplaceholder.typicode.com/posts/1 ' );
33+ $ this ->sot ->seeMockRequestWasCalled ('get-post-1 ' , 2 );
34+ }
35+
2836 public function testExpectationNotWasCalledThrowException2 (): void
2937 {
3038 $ this ->expectException (ExpectationFailedException::class);
You can’t perform that action at this time.
0 commit comments