Changeset View
Changeset View
Standalone View
Standalone View
src/search/__tests__/PhutilSearchQueryCompilerTestCase.php
| Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | public function testCompileQueriesWithStemming() { | ||||
| $this->assertCompileQueries($stemming_tests, null, $stemmer); | $this->assertCompileQueries($stemming_tests, null, $stemmer); | ||||
| } | } | ||||
| public function testCompileQueriesWithFunctions() { | public function testCompileQueriesWithFunctions() { | ||||
| $op_and = PhutilSearchQueryCompiler::OPERATOR_AND; | $op_and = PhutilSearchQueryCompiler::OPERATOR_AND; | ||||
| $op_sub = PhutilSearchQueryCompiler::OPERATOR_SUBSTRING; | $op_sub = PhutilSearchQueryCompiler::OPERATOR_SUBSTRING; | ||||
| $op_exact = PhutilSearchQueryCompiler::OPERATOR_EXACT; | $op_exact = PhutilSearchQueryCompiler::OPERATOR_EXACT; | ||||
| $mao = "\xE7\x8C\xAB"; | |||||
amckinley: Do we try to avoid embedding actual Unicode characters in source? | |||||
| $function_tests = array( | $function_tests = array( | ||||
| 'cat' => array( | 'cat' => array( | ||||
| array(null, $op_and, 'cat'), | array(null, $op_and, 'cat'), | ||||
| ), | ), | ||||
| ':cat' => array( | ':cat' => array( | ||||
| array(null, $op_and, 'cat'), | array(null, $op_and, 'cat'), | ||||
| ), | ), | ||||
| 'title:cat' => array( | 'title:cat' => array( | ||||
| Show All 11 Lines | $function_tests = array( | ||||
| ), | ), | ||||
| 'title:cat title:dog' => array( | 'title:cat title:dog' => array( | ||||
| array('title', $op_and, 'cat'), | array('title', $op_and, 'cat'), | ||||
| array('title', $op_and, 'dog'), | array('title', $op_and, 'dog'), | ||||
| ), | ), | ||||
| '~"core and seven years ag"' => array( | '~"core and seven years ag"' => array( | ||||
| array(null, $op_sub, 'core and seven years ag'), | array(null, $op_sub, 'core and seven years ag'), | ||||
| ), | ), | ||||
| $mao => array( | |||||
| array(null, $op_sub, $mao), | |||||
| ), | |||||
| '+'.$mao => array( | |||||
| array(null, $op_and, $mao), | |||||
| ), | |||||
| '~'.$mao => array( | |||||
| array(null, $op_sub, $mao), | |||||
| ), | |||||
| '"'.$mao.'"' => array( | |||||
| array(null, $op_and, $mao), | |||||
| ), | |||||
| ); | ); | ||||
| $this->assertCompileFunctionQueries($function_tests); | $this->assertCompileFunctionQueries($function_tests); | ||||
| } | } | ||||
| private function assertCompileQueries( | private function assertCompileQueries( | ||||
| array $tests, | array $tests, | ||||
| $operators = null, | $operators = null, | ||||
| ▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines | |||||
Do we try to avoid embedding actual Unicode characters in source?