Enforce lowercase on domain name filter

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2016-11-26 19:52:50 +01:00
parent ebe50a85fb
commit 00fc2b44f4
2 changed files with 10 additions and 1 deletions

View File

@ -90,7 +90,7 @@ class EntryFilterType extends AbstractType
if (strlen($value) <= 2 || empty($value)) { if (strlen($value) <= 2 || empty($value)) {
return; return;
} }
$expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->literal('%'.$value.'%')); $expression = $filterQuery->getExpr()->like($field, $filterQuery->getExpr()->lower($filterQuery->getExpr()->literal('%'.$value.'%')));
return $filterQuery->createCondition($expression); return $filterQuery->createCondition($expression);
}, },

View File

@ -725,6 +725,15 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]')); $this->assertCount(5, $crawler->filter('div[class=entry]'));
$crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form();
$data = [
'entry_filter[domainName]' => 'dOmain',
];
$crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]'));
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = [ $data = [
'entry_filter[domainName]' => 'wallabag', 'entry_filter[domainName]' => 'wallabag',