Add FilterTest::testSpecialCharacterEscaping()

refs #2523
This commit is contained in:
Alexander A. Klimov 2017-02-13 13:09:12 +01:00
parent c810f2bfd1
commit 24c8a924e6
1 changed files with 14 additions and 0 deletions

View File

@ -269,6 +269,20 @@ class FilterTest extends BaseTestCase
);
}
/**
* Test whether special characters inside values are URL-encoded, but the other ones aren't
*/
public function testSpecialCharacterEscaping()
{
$this->assertSame(
Filter::matchAll(
Filter::expression('host', '!=', 'localhost'),
Filter::matchAny(Filter::where('service', 'ping4'), Filter::where('specialchars', '(|&!=)'))
)->toQueryString(),
'host!=localhost&(service=ping4|specialchars=%28%7C%26%21%3D%29)'
);
}
private function row($idx)
{
return $this->sampleData[$idx];