summaryrefslogtreecommitdiff
path: root/tests/units/LexerTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
commit2e7e7031804b09a04c83896535b31acb12138960 (patch)
treeafc617dc3679c464b7cb7e8ec6ff96c3bf1cdfb5 /tests/units/LexerTest.php
parent7af5a923b047f612c02af2fe39a09beb45792f3a (diff)
Add status attribute for advanced search
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 4abe451b..7ba3801c 100644
--- a/tests/units/LexerTest.php
+++ b/tests/units/LexerTest.php
@@ -66,6 +66,36 @@ class LexerTest extends Base
);
}
+ public function testStatusQuery()
+ {
+ $lexer = new Lexer;
+
+ $this->assertEquals(
+ array(array('match' => 'status:', 'token' => 'T_STATUS'), array('match' => 'open', 'token' => 'T_STRING')),
+ $lexer->tokenize('status:open')
+ );
+
+ $this->assertEquals(
+ array(array('match' => 'status:', 'token' => 'T_STATUS'), array('match' => 'closed', 'token' => 'T_STRING')),
+ $lexer->tokenize('status:closed')
+ );
+
+ $this->assertEquals(
+ array('T_STATUS' => 'open'),
+ $lexer->map($lexer->tokenize('status:open'))
+ );
+
+ $this->assertEquals(
+ array('T_STATUS' => 'closed'),
+ $lexer->map($lexer->tokenize('status:closed'))
+ );
+
+ $this->assertEquals(
+ array(),
+ $lexer->map($lexer->tokenize('status: '))
+ );
+ }
+
public function testDueDateQuery()
{
$lexer = new Lexer;