diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | app/Core/Filter/LexerBuilder.php | 2 | ||||
-rw-r--r-- | tests/units/Core/Filter/LexerBuilderTest.php | 20 |
3 files changed, 22 insertions, 1 deletions
@@ -9,6 +9,7 @@ New features: Improvements: +* Make search attributes not case sensitive * Display TOTP issuer for 2FA * Make sure that the table schema_version use InnoDB for Mysql diff --git a/app/Core/Filter/LexerBuilder.php b/app/Core/Filter/LexerBuilder.php index 7a9a714f..626d7614 100644 --- a/app/Core/Filter/LexerBuilder.php +++ b/app/Core/Filter/LexerBuilder.php @@ -69,7 +69,7 @@ class LexerBuilder foreach ($attributes as $attribute) { $this->filters[$attribute] = $filter; - $this->lexer->addToken(sprintf("/^(%s:)/", $attribute), $attribute); + $this->lexer->addToken(sprintf("/^(%s:)/i", $attribute), $attribute); if ($default) { $this->lexer->setDefaultToken($attribute); diff --git a/tests/units/Core/Filter/LexerBuilderTest.php b/tests/units/Core/Filter/LexerBuilderTest.php index 23726f32..65bb87b9 100644 --- a/tests/units/Core/Filter/LexerBuilderTest.php +++ b/tests/units/Core/Filter/LexerBuilderTest.php @@ -103,4 +103,24 @@ class LexerBuilderTest extends Base $this->assertFalse($builder === $clone); $this->assertFalse($builder->build('test')->getQuery() === $clone->build('test')->getQuery()); } + + public function testBuilderWithMixedCaseSearchAttribute() + { + $project = new ProjectModel($this->container); + $taskCreation = new TaskCreationModel($this->container); + $taskFinder = new TaskFinderModel($this->container); + $query = $taskFinder->getExtendedQuery(); + + $this->assertEquals(1, $project->create(array('name' => 'Project'))); + $this->assertNotFalse($taskCreation->create(array('project_id' => 1, 'title' => 'Test'))); + + $builder = new LexerBuilder(); + $builder->withFilter(new TaskAssigneeFilter()); + $builder->withFilter(new TaskTitleFilter(), true); + $builder->withQuery($query); + $tasks = $builder->build('AsSignEe:nobody')->toArray(); + + $this->assertCount(1, $tasks); + $this->assertEquals('Test', $tasks[0]['title']); + } } |