Exemplo n.º 1
0
 /**
  * @dataProvider getFormatAndBody
  */
 public function testCreateFindAllRequest($format, $expectedBody, $parameters, $requirements, $expectedQueryString)
 {
     $this->factory->setFormat($format);
     $this->urlGenerator->expects($this->once())->method('getFindAllUrl')->with('blogs', $parameters, $requirements)->will($this->returnValue('/blogs' . $expectedQueryString));
     $request = $this->factory->createFindAllRequest(Blog::class, $parameters);
     $this->assertEquals('GET', $request->getMethod());
     $this->assertEquals('application/' . $format, $request->getHeaderLine('Content-Type'));
     $this->assertEquals('/blogs' . $expectedQueryString, $request->getUri());
     $this->assertEquals('', (string) $request->getBody());
 }
Exemplo n.º 2
0
 /**
  * @param array $parameters
  * @param array $requirements
  *
  * @return object
  */
 public function findAll(array $parameters = [], array $requirements = [])
 {
     $request = $this->requestFactory->createFindAllRequest($this->class, $parameters, $requirements);
     $response = $this->client->send($request);
     return $this->responseMapper->map($response, sprintf('array<%s>', $this->class), 'json');
 }