Remove client dependency in test, use $this->request instead

This commit is contained in:
Benoît Burnichon
2016-05-16 19:33:54 +02:00
parent bbc36a7bfe
commit 5bcb253be3

View File

@@ -841,17 +841,15 @@ class ApiJsonTest extends ApiTestCase
self::$DI['record_story_1']; self::$DI['record_story_1'];
$client = $this->getClient(); $response = $this->request(
$client->request(
'POST', 'POST',
'/api/v1/search/', '/api/v1/search/',
$this->getParameters(['search_type' => SearchEngineOptions::RECORD_GROUPING]), $this->getParameters(['search_type' => SearchEngineOptions::RECORD_GROUPING]),
[],
['HTTP_Accept' => $this->getAcceptMimeType()] ['HTTP_Accept' => $this->getAcceptMimeType()]
); );
$content = $this->unserialize($client->getResponse()->getContent()); $content = $this->unserialize($response->getContent());
$this->evaluateResponse200($client->getResponse()); $this->evaluateResponse200($response);
$this->evaluateMeta200($content); $this->evaluateMeta200($content);
$response = $content['response']; $response = $content['response'];
@@ -877,10 +875,10 @@ class ApiJsonTest extends ApiTestCase
public function testRecordsSearchRoute() public function testRecordsSearchRoute()
{ {
$this->setToken($this->userAccessToken); $this->setToken($this->userAccessToken);
self::$DI['client']->request('POST', '/api/v1/records/search/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]); $response = $this->request('POST', '/api/v1/records/search/', $this->getParameters(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent()); $content = $this->unserialize($response->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse()); $this->evaluateResponse200($response);
$this->evaluateMeta200($content); $this->evaluateMeta200($content);
$response = $content['response']; $response = $content['response'];