From e90be82c35bbdea06645b9a2750fdbd2afbb898b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 30 Apr 2021 10:50:40 +0200 Subject: [PATCH] Add test case for special characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../unit/Search/Query/AQueryParameterTest.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/unit/Search/Query/AQueryParameterTest.php diff --git a/tests/unit/Search/Query/AQueryParameterTest.php b/tests/unit/Search/Query/AQueryParameterTest.php new file mode 100644 index 000000000..75ae862c0 --- /dev/null +++ b/tests/unit/Search/Query/AQueryParameterTest.php @@ -0,0 +1,47 @@ + + * + * @author Julius Härtl + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +declare(strict_types=1); + +namespace OCA\Deck\Search\Query; + +use PHPUnit\Framework\TestCase; + +class AQueryParameterTest extends TestCase { + public function dataValue() { + return [ + ['foo', 'foo'], + ['spätial character', 'spätial character'], + ['"spätial character"', 'spätial character'], + ['"spätial "character"', 'spätial "character'], + ['"spätial 🐘"', 'spätial 🐘'], + ['\'spätial character\'', '\'spätial character\''], + ]; + } + + /** @dataProvider dataValue */ + public function testValue($input, $expectedValue) { + $parameter = new StringQueryParameter('test', 0, $input); + $this->assertEquals($expectedValue, $parameter->getValue()); + } +}