diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/QueryBuilderTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/QueryBuilderTest.php index d542dc3d7055f25b05c2e198d06b1509d1fb327f..e7aa591980c12dca1bb6c19f4b4aa11e80d4fbb0 100644 --- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/QueryBuilderTest.php +++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/QueryBuilderTest.php @@ -162,4 +162,32 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase $this->assertEquals($output, $processedQ[0]); } } + + /** + * Test generation with a query handler + * + * @return void + */ + public function testQueryHandler() + { + // Set up an array of expected inputs and outputs: + // @codingStandardsIgnoreStart + $tests = array( + array('this?', '((this?) OR (this\?))'),// trailing question mark + ); + // @codingStandardsIgnoreEnd + + $qb = new QueryBuilder( + array( + 'test' => array() + ) + ); + foreach ($tests as $test) { + list($input, $output) = $test; + $q = new Query($input, 'test'); + $response = $qb->build($q); + $processedQ = $response->get('q'); + $this->assertEquals($output, $processedQ[0]); + } + } } \ No newline at end of file