add testSearchQueryInfiniteLoopEmptyLiteral().

This commit is contained in:
Naofumi 2019-11-06 12:14:18 +09:00
commit 983a631e60

View file

@ -526,4 +526,32 @@ class SearchPluginTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(400, $response->getStatus()); $this->assertEquals(400, $response->getStatus());
} }
public function testSearchQueryInfiniteLoopEmptyLiteral() {
$this->searchBackend->expects($this->any())
->method('getArbiterPath')
->willReturn('foo');
$plugin = new SearchPlugin($this->searchBackend);
$server = new Server();
$plugin->initialize($server);
$request = new Request('SEARCH', '/index.php/foo', [
'Content-Type' => 'text/xml'
]);
$request->setBaseUrl('/index.php');
$request->setBody(fopen(__DIR__ . '/infiniteloopemptyliteral.xml', 'r'));
$response = new Response();
$this->searchBackend->expects($this->any())
->method('isValidScope')
->willReturn(true);
$this->searchBackend->expects($this->never())
->method('search');
$plugin->searchHandler($request, $response);
$this->assertEquals(400, $response->getStatus());
}
} }