コード例 #1
0
 /**
  * @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());
 }
コード例 #2
0
 /**
  * @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;
 }
コード例 #3
0
 /**
  * @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);
 }
コード例 #4
0
 /**
  * @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));
 }