setAuthToken(AuthKeysFixture::ADMIN_API_KEY); $this->initializeWireMock(); $stub = $this->mockCerebrateStatusResponse(); $url = sprintf('%s/%d', self::ENDPOINT, BroodsFixture::BROOD_WIREMOCK_ID); $this->get($url); $this->verifyStubCalled($stub); $this->assertResponseOk(); $this->assertResponseContains('"user": "wiremock"'); } private function mockCerebrateStatusResponse(): \WireMock\Stubbing\StubMapping { return $this->getWireMock()->stubFor( WireMock::get(WireMock::urlEqualTo('/instance/status.json')) ->willReturn(WireMock::aResponse() ->withHeader('Content-Type', 'application/json') ->withBody((string)json_encode( [ "version" => "0.1", "application" => "Cerebrate", "user" => [ "id" => 1, "username" => "wiremock", "role" => [ "id" => 1 ] ] ] ))) ); } }