File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 44 bootstrap =" vendor/autoload.php"
55 cacheResultFile =" var/phpunit/test-results"
66 executionOrder =" depends,defects"
7- forceCoversAnnotation =" true "
7+ forceCoversAnnotation =" false "
88 beStrictAboutCoversAnnotation =" true"
99 beStrictAboutOutputDuringTests =" true"
1010 beStrictAboutTodoAnnotatedTests =" true"
Original file line number Diff line number Diff line change 33namespace Integration ;
44
55use DEVizzent \CodeceptionMockServerHelper \MockServerHelper ;
6+ use GuzzleHttp \Client ;
7+ use PHPUnit \Framework \ExpectationFailedException ;
68use PHPUnit \Framework \TestCase ;
79
810class SeeMockRequestWasCalledTest extends TestCase
911{
1012 private MockServerHelper $ sot ;
13+ private Client $ client ;
1114
1215 protected function setUp (): void
1316 {
1417 parent ::setUp ();
1518 $ this ->sot = new MockServerHelper ();
19+ $ this ->client = new Client (['proxy ' => 'http://mockserver:1080 ' , 'verify ' => false ]);
1620 }
1721
18- public function testExpectationNotWasCalledThrowException (): void
22+ public function testExpectationWasCalledNotThrowException (): void
1923 {
20- $ this ->sot ->seeMockRequestWasCalled ('some-expectation ' );
24+ $ this ->client ->request ('GET ' , 'https://jsonplaceholder.typicode.com/posts/1 ' , []);
25+ $ this ->sot ->seeMockRequestWasCalled ('get-post-1 ' );
26+ }
27+
28+ public function testExpectationNotWasCalledThrowException2 (): void
29+ {
30+ $ this ->expectException (ExpectationFailedException::class);
31+ $ this ->expectExceptionMessage (
32+ 'No expectation found with id not-existing-expectation ' . PHP_EOL
33+ . 'Failed asserting that 400 matches expected 202. '
34+ );
35+ $ this ->sot ->seeMockRequestWasCalled ('not-existing-expectation ' );
2136 }
2237}
You can’t perform that action at this time.
0 commit comments