/** * @test * @group small * @covers ::patch * @covers ::<private> */ public function patch() { $response = $this->restClient->patch($this->getHTTP200Route(), 'test'); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response); $this->assertEquals(200, $response->getStatusCode()); $this->assertNotEmpty($response->getContent()); }
/** * @param string $url * @param string $targetClass * * @return BaseResponse * * @throws RuntimeException */ protected function doGetObjectsRequest(string $url, string $targetClass) : BaseResponse { // TODO Do something on response error codes $rawResponse = $this->client->get($url); // TODO Catch error on malformatted json $deserializedResponse = $this->serializer->deserialize($rawResponse->getContent(), $targetClass, 'json'); return $deserializedResponse; }
/** * @expectedException \AppBundle\WebService\SR\Exception\InvalidEpisodeException */ public function testGetEpisodePlaylistEpisodeNotFound() { $client = new SrWebServiceClient($this->restClient, $this->serializer); $this->restClient->expects($this->once())->method('get')->willReturn(new Response('', 404)); $client->getEpisodePlaylist(42); }
/** * @test * @group small * @covers ::setContentType * @covers ::<private> */ public function setContentType() { $contentType = 'application/json'; $this->curl->expects($this->once())->method('setContentType')->with($this->equalTo($contentType)); $this->assertInstanceOf(get_class($this->restClient), $this->restClient->setContentType($contentType)); }