mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
Fix #1524 : API search query is discarded with GET method
This commit is contained in:
@@ -890,7 +890,7 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
$offsetStart = (int) ($request->get('offset_start') ? : 0);
|
$offsetStart = (int) ($request->get('offset_start') ? : 0);
|
||||||
$perPage = (int) $request->get('per_page') ? : 10;
|
$perPage = (int) $request->get('per_page') ? : 10;
|
||||||
|
|
||||||
$query = (string) $request->request->get('query');
|
$query = (string) $request->get('query');
|
||||||
|
|
||||||
$this->app['phraseanet.SE']->setOptions($options);
|
$this->app['phraseanet.SE']->setOptions($options);
|
||||||
$this->app['phraseanet.SE']->resetCache();
|
$this->app['phraseanet.SE']->resetCache();
|
||||||
|
@@ -924,6 +924,29 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideAvailableSearchMethods
|
||||||
|
*/
|
||||||
|
public function testRecordsSearchRouteWithQuery($method)
|
||||||
|
{
|
||||||
|
$this->setToken(self::$token);
|
||||||
|
self::$DI['app']['phraseanet.SE'] = $this->getMock('Alchemy\Phrasea\SearchEngine\SearchEngineInterface');
|
||||||
|
self::$DI['app']['phraseanet.SE']->expects($this->once())
|
||||||
|
->method('query')
|
||||||
|
->with('koala', 0, 10)
|
||||||
|
->will($this->returnValue(
|
||||||
|
$this->getMockBuilder('Alchemy\Phrasea\SearchEngine\SearchEngineResult')
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock()
|
||||||
|
));
|
||||||
|
$crawler = self::$DI['client']->request($method, '/api/v1/records/search/', $this->getParameters(array('query' => 'koala')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function provideAvailableSearchMethods()
|
||||||
|
{
|
||||||
|
return array(array('POST'), array('GET'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \API_V1_adapter::caption_records
|
* @covers \API_V1_adapter::caption_records
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user