diff options
| author | Frederic Guillot <fred@kanboard.net> | 2015-07-01 19:32:51 -0400 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2015-07-01 19:32:51 -0400 |
| commit | 471e46e70294684efc6d7edfc814d5b9ca04738b (patch) | |
| tree | be35eb01fe0f9222406ec1c3c165a78d07397788 /tests/units/LexerTest.php | |
| parent | 107699e5ed61175cc45eba6d59219d8a40946291 (diff) | |
Add project and column attributes for advanced search
Diffstat (limited to 'tests/units/LexerTest.php')
| -rw-r--r-- | tests/units/LexerTest.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/units/LexerTest.php b/tests/units/LexerTest.php index 4d0d67ad..38974357 100644 --- a/tests/units/LexerTest.php +++ b/tests/units/LexerTest.php @@ -91,6 +91,56 @@ class LexerTest extends Base ); } + public function testColumnQuery() + { + $lexer = new Lexer; + + $this->assertEquals( + array(array('match' => 'column:', 'token' => 'T_COLUMN'), array('match' => 'Feature Request', 'token' => 'T_STRING')), + $lexer->tokenize('column:"Feature Request"') + ); + + $this->assertEquals( + array('T_COLUMN' => array('Feature Request')), + $lexer->map($lexer->tokenize('column:"Feature Request"')) + ); + + $this->assertEquals( + array('T_COLUMN' => array('Feature Request', 'Bug')), + $lexer->map($lexer->tokenize('column:"Feature Request" column:Bug')) + ); + + $this->assertEquals( + array(), + $lexer->map($lexer->tokenize('column: ')) + ); + } + + public function testProjectQuery() + { + $lexer = new Lexer; + + $this->assertEquals( + array(array('match' => 'project:', 'token' => 'T_PROJECT'), array('match' => 'My project', 'token' => 'T_STRING')), + $lexer->tokenize('project:"My project"') + ); + + $this->assertEquals( + array('T_PROJECT' => array('My project')), + $lexer->map($lexer->tokenize('project:"My project"')) + ); + + $this->assertEquals( + array('T_PROJECT' => array('My project', 'plop')), + $lexer->map($lexer->tokenize('project:"My project" project:plop')) + ); + + $this->assertEquals( + array(), + $lexer->map($lexer->tokenize('project: ')) + ); + } + public function testStatusQuery() { $lexer = new Lexer; |
