From 34c5063c354d68edcd3ed006512341cc7a3e1f94 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 18 Jun 2013 09:55:12 -0400 Subject: [PATCH] Added test case to support previous commit. --- .../Backend/Solr/QueryBuilderTest.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) 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 d542dc3d705..e7aa591980c 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 -- GitLab