summaryrefslogtreecommitdiff
path: root/tests/units/LexerTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-04 17:35:52 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-04 17:35:52 -0400
commit198f3eda90807c0295a013cd4ebdc3806545d608 (patch)
tree07420711d703bf71f0b1596a891ec6957c71719b /tests/units/LexerTest.php
parent0e5756ecc162a8428e6ab3820562f45ef17f9e8b (diff)
Add search attribute to search by reference
Diffstat (limited to 'tests/units/LexerTest.php')
-rw-r--r--tests/units/LexerTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/units/LexerTest.php b/tests/units/LexerTest.php
index 38974357..0e3a61ae 100644
--- a/tests/units/LexerTest.php
+++ b/tests/units/LexerTest.php
@@ -171,6 +171,36 @@ class LexerTest extends Base
);
}
+ public function testReferenceQuery()
+ {
+ $lexer = new Lexer;
+
+ $this->assertEquals(
+ array(array('match' => 'ref:', 'token' => 'T_REFERENCE'), array('match' => '123', 'token' => 'T_STRING')),
+ $lexer->tokenize('ref:123')
+ );
+
+ $this->assertEquals(
+ array(array('match' => 'reference:', 'token' => 'T_REFERENCE'), array('match' => '456', 'token' => 'T_STRING')),
+ $lexer->tokenize('reference:456')
+ );
+
+ $this->assertEquals(
+ array('T_REFERENCE' => '123'),
+ $lexer->map($lexer->tokenize('reference:123'))
+ );
+
+ $this->assertEquals(
+ array('T_REFERENCE' => '456'),
+ $lexer->map($lexer->tokenize('ref:456'))
+ );
+
+ $this->assertEquals(
+ array(),
+ $lexer->map($lexer->tokenize('ref: '))
+ );
+ }
+
public function testDescriptionQuery()
{
$lexer = new Lexer;