11
11
12
12
class FeatureContext implements Context
13
13
{
14
- // See docker-compose.yml
15
- private const WIREMOCK_HOST = 'wiremock ' ;
16
- private const WIREMOCK_PORT = '8080 ' ;
14
+ // See .env.test
15
+ private const ACCUWEATHER_API_KEY = 'accuweatherTestKey ' ;
17
16
18
17
private KernelInterface $ kernel ;
19
18
private Connection $ dbal ;
20
- private string $ accuweatherApiKey ;
21
19
private WireMock $ wireMock ;
22
20
private ?Response $ response ;
23
21
24
- public function __construct (KernelInterface $ kernel , Connection $ dbal , string $ accuweatherApiKey )
22
+ public function __construct (KernelInterface $ kernel , Connection $ dbal , WireMock $ wireMock )
25
23
{
26
24
$ this ->kernel = $ kernel ;
27
- $ this ->wireMock = WireMock:: create ( self :: WIREMOCK_HOST , self :: WIREMOCK_PORT ) ;
25
+ $ this ->wireMock = $ wireMock ;
28
26
Assert::assertTrue ($ this ->wireMock ->isAlive (), 'Wiremock should be alive ' );
29
- $ this ->accuweatherApiKey = $ accuweatherApiKey ;
30
27
$ this ->dbal = $ dbal ;
31
28
}
32
29
@@ -44,7 +41,7 @@ public function resetState()
44
41
*/
45
42
public function currentTemperatureIs ($ temperature )
46
43
{
47
- $ uri = '/currentconditions/v1/623?apikey= ' .$ this -> accuweatherApiKey ;
44
+ $ uri = '/currentconditions/v1/623?apikey= ' .self :: ACCUWEATHER_API_KEY ;
48
45
$ body = <<<EOD
49
46
[{
50
47
"LocalObservationDateTime": "2020-10-17T17:50:00+02:00",
0 commit comments