File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 33namespace DEVizzent \CodeceptionMockServerHelper \Config ;
44
55use DEVizzent \CodeceptionMockServerHelper \MockServerHelper ;
6+ use InvalidArgumentException ;
67use RecursiveDirectoryIterator ;
78use RecursiveIteratorIterator ;
89use SplFileInfo ;
@@ -13,24 +14,27 @@ class ExpectationsPath
1314
1415 public function __construct (string $ path = '' )
1516 {
16- if (! empty ( $ path) ) {
17+ if ('' === $ path ) {
1718 $ this ->set ($ path );
1819 }
1920 }
2021
21- private function set (string $ path )
22+ private function set (string $ path ): void
2223 {
2324 $ path = realpath ($ path );
24- if ($ path ) {
25+ if (false !== $ path ) {
2526 $ this ->path = $ path ;
2627 return ;
2728 }
28- throw new \ InvalidArgumentException (sprintf ('"%s" is not a valid path for "expectationsPath" ' , $ path ));
29+ throw new InvalidArgumentException (sprintf ('"%s" is not a valid path for "expectationsPath" ' , $ path ));
2930 }
3031
32+ /**
33+ * @return array<string>
34+ */
3135 public function getExpectationsFiles (): iterable
3236 {
33- if (empty ( $ this ->path ) ) {
37+ if ('' !== $ this ->path ) {
3438 return [];
3539 }
3640 if (!is_dir ($ this ->path )) {
@@ -40,11 +44,11 @@ public function getExpectationsFiles(): iterable
4044 $ files = [];
4145 /** @var SplFileInfo $file */
4246 foreach ($ recursiveIterator as $ file ) {
43- if ($ file ->isDir ()){
47+ if ($ file ->isDir ()) {
4448 continue ;
4549 }
4650 $ files [] = $ file ->getPathname ();
4751 }
4852 return $ files ;
4953 }
50- }
54+ }
Original file line number Diff line number Diff line change @@ -58,7 +58,9 @@ public function _initialize(): void
5858
5959 try {
6060 $ this ->deactivateNotMatchedRequest ();
61- } catch (AssertionFailedError $ exception ) {}
61+ } catch (AssertionFailedError $ exception ) {
62+ return ;
63+ }
6264 }
6365
6466 public function _beforeSuite ($ settings = []): void
@@ -130,7 +132,7 @@ public function deactivateNotMatchedRequest(): void
130132 $ this ->mockserver ->removeById (self ::NOT_MATCHED_REQUEST_ID );
131133 }
132134
133- public function createMockRequestFromJsonFile ($ expectationFile ): void
135+ public function createMockRequestFromJsonFile (string $ expectationFile ): void
134136 {
135137 $ expectationJson = file_get_contents ($ expectationFile );
136138 Assert::assertIsString ($ expectationJson );
You can’t perform that action at this time.
0 commit comments