|
19 | 19 |
|
20 | 20 | use Codeception\Platform\Extension as CodeceptionExtension; |
21 | 21 | use WireMock\Client\WireMock as WireMockClient; |
22 | | -use Mcustiel\DependencyInjection\DependencyContainer; |
23 | 22 |
|
24 | 23 | /** |
25 | 24 | * Codeception Extension for WireMock |
@@ -66,25 +65,13 @@ public function __construct( |
66 | 65 |
|
67 | 66 | $this->config = $this->argumentsManager->sanitize($this->config); |
68 | 67 |
|
69 | | - if (!empty($this->config['host'])) { |
70 | | - echo "Connecting to wiremock host {$this->config['host']}" . PHP_EOL; |
71 | | - $host = $this->config['host']; |
72 | | - } else { |
73 | | - echo "Starting local wiremock" . PHP_EOL; |
74 | | - $this->process->start( |
75 | | - $this->getJarPath(), |
76 | | - $this->config['logs-path'], |
77 | | - $this->mapConfigToWireMockArguments($this->config) |
78 | | - ); |
79 | | - $host = 'localhost'; |
80 | | - sleep($this->config['start-delay']); |
81 | | - } |
82 | | - DependencyContainer::getInstance()->add( |
83 | | - 'wiremockConnection', |
84 | | - function() use ($host) { |
85 | | - return WireMockClient::create($host, $this->config['port']); |
86 | | - } |
| 68 | + echo "Starting local wiremock" . PHP_EOL; |
| 69 | + $this->process->start( |
| 70 | + $this->getJarPath(), |
| 71 | + $this->config['logs-path'], |
| 72 | + $this->mapConfigToWireMockArguments($this->config) |
87 | 73 | ); |
| 74 | + sleep($this->config['start-delay']); |
88 | 75 | } |
89 | 76 |
|
90 | 77 | private function initWireMockProcess($process) |
@@ -119,7 +106,7 @@ private function initWireMockArgumentsManager($argumentsManager) |
119 | 106 | */ |
120 | 107 | public function __destruct() |
121 | 108 | { |
122 | | - $connection = DependencyContainer::getInstance()->get('wiremockConnection'); |
| 109 | + $connection = WireMockClient::create('localhost', $this->config['port']); |
123 | 110 | if ($connection->isAlive()) { |
124 | 111 | $connection->shutdownServer(); |
125 | 112 | } |
|
0 commit comments