filter: Add test for whitespace sanitizing

This commit is contained in:
Eric Lippmann 2014-10-01 03:23:06 +02:00
parent 46078f50db
commit 56a1af47e7
1 changed files with 10 additions and 0 deletions

View File

@ -199,6 +199,16 @@ class FilterTest extends BaseTestCase
$this->assertNotEquals((string) $c, (string) $d);
}
public function testLeadingAndTrailingWhitespacesSanitizing()
{
$columnHasWhitespaces = Filter::where(' host ', 'localhost');
$expressionHasWhitespaces = Filter::where('host', ' localhost ');
$bothHaveWhitespaces = Filter::fromQueryString(' host = localhost ');
$this->assertTrue($columnHasWhitespaces->matches($this->sampleData[0]));
$this->assertTrue($expressionHasWhitespaces->matches($this->sampleData[0]));
$this->assertTrue($bothHaveWhitespaces->matches($this->sampleData[0]));
}
private function row($idx)
{
return $this->sampleData[$idx];