Add unit test for PR #2766

This commit is contained in:
Frederic Guillot 2017-02-05 12:59:39 -05:00
parent a9a53e05a0
commit 99b3bfae16
2 changed files with 29 additions and 0 deletions

View File

@ -11,6 +11,10 @@ Improvements:
* Comments are highlighted if hash (#comment-123) is present in URL
* Documentation translated in Turkish
Bug fixes:
* Search with multiple expressions with double quotes was not working
Version 1.0.38 (Jan 28, 2017)
-----------------------------

View File

@ -149,4 +149,29 @@ class LexerBuilderTest extends Base
$this->assertEquals('Test 1', $tasks[0]['title']);
$this->assertEquals('Test 2', $tasks[1]['title']);
}
public function testWithMultipleExpressionsWithQuotes()
{
$taskFinder = new TaskFinderModel($this->container);
$taskCreation = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$userModel = new UserModel($this->container);
$query = $taskFinder->getExtendedQuery();
$this->assertEquals(2, $userModel->create(array('username' => 'foobar', 'name' => 'Foo Bar')));
$this->assertEquals(1, $projectModel->create(array('name' => 'Test')));
$this->assertEquals(1, $taskCreation->create(array('title' => 'Test 1', 'project_id' => 1, 'owner_id' => 2)));
$this->assertEquals(2, $taskCreation->create(array('title' => 'Test 2', 'project_id' => 1, 'owner_id' => 1)));
$this->assertEquals(3, $taskCreation->create(array('title' => 'Test 3', 'project_id' => 1, 'owner_id' => 0)));
$builder = new LexerBuilder();
$builder->withFilter(new TaskAssigneeFilter());
$builder->withFilter(new TaskTitleFilter(), true);
$builder->withQuery($query);
$tasks = $builder->build('assignee:"admin" assignee:"foobar"')->toArray();
$this->assertCount(2, $tasks);
$this->assertEquals('Test 1', $tasks[0]['title']);
$this->assertEquals('Test 2', $tasks[1]['title']);
}
}