File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 22
33namespace DEVizzent \CodeceptionMockServerHelper ;
44
5+ use Codeception \Lib \ModuleContainer ;
56use Codeception \Module ;
67use Codeception \TestInterface ;
78use GuzzleHttp \Client ;
1011
1112class MockServerHelper extends Module
1213{
13-
14- /**
15- * @var array<string, string> $config
16- */
17- protected array $ config = [
18- 'url ' => 'http://mockserver:1080 ' ,
19- 'cleanupBefore ' => 'test '
20- ];
21-
2214 private Client $ mockserverClient ;
15+ public function __construct (ModuleContainer $ moduleContainer , ?array $ config = null )
16+ {
17+ $ this ->requiredFields = ['url ' ];
18+ $ this ->config ['cleanupBefore ' ] = 'test ' ;
19+ parent ::__construct ($ moduleContainer , $ config );
20+ }
2321
2422
2523 public function _initialize (): void
2624 {
27- $ this ->mockserverClient = new Client (['base_uri ' => $ this ->config ['url ' ]]);
25+ $ this ->mockserverClient = new Client ([
26+ 'base_uri ' => $ this ->config ['url ' ]
27+ ]);
2828 }
2929
3030 public function _beforeSuite (array $ settings = []): void
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ protected function setUp(): void
1717 {
1818 parent ::setUp ();
1919 $ moduleContainer = $ this ->createMock (ModuleContainer::class);
20- $ this ->sot = new MockServerHelper ($ moduleContainer );
20+ $ this ->sot = new MockServerHelper ($ moduleContainer, [ ' url ' => ' http://mockserver:1080 ' ] );
2121 $ this ->sot ->_initialize ();
2222 $ this ->client = new Client (['proxy ' => 'http://mockserver:1080 ' , 'verify ' => false ]);
2323 $ this ->sot ->clearMockServerLogs ();
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ protected function setUp(): void
1717 {
1818 parent ::setUp ();
1919 $ moduleContainer = $ this ->createMock (ModuleContainer::class);
20- $ this ->sot = new MockServerHelper ($ moduleContainer );
20+ $ this ->sot = new MockServerHelper ($ moduleContainer, [ ' url ' => ' http://mockserver:1080 ' ] );
2121 $ this ->sot ->_initialize ();
2222 $ this ->client = new Client (['proxy ' => 'http://mockserver:1080 ' , 'verify ' => false ]);
2323 $ this ->sot ->clearMockServerLogs ();
You can’t perform that action at this time.
0 commit comments