From aeb74275138aefdb837881b59c6a2236a53ab624 Mon Sep 17 00:00:00 2001 From: bakaneko Date: Fri, 21 Feb 2025 22:17:58 +0900 Subject: [PATCH 1/2] use correct dataprovider --- tests/ZalgoTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ZalgoTest.php b/tests/ZalgoTest.php index 09b54ac50ba..b222d41d9d5 100644 --- a/tests/ZalgoTest.php +++ b/tests/ZalgoTest.php @@ -10,7 +10,7 @@ class ZalgoTest extends TestCase { /** - * @dataProvider zalgoExamples + * @dataProvider combinationExamples */ public function testCombination($text) { @@ -41,7 +41,7 @@ public function testUnzalgo($expected, $level) $this->assertSame(unzalgo($text, $level), $expected); } - public function combinationExamples() + public static function combinationExamples() { return [ ['👩🏻‍⚕️'], From 084396b965b9540f8b2a827fde1f141c3a986000 Mon Sep 17 00:00:00 2001 From: bakaneko Date: Fri, 21 Feb 2025 22:19:55 +0900 Subject: [PATCH 2/2] fix order; rename dataProviders; declare strict_types --- tests/ZalgoTest.php | 46 +++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tests/ZalgoTest.php b/tests/ZalgoTest.php index b222d41d9d5..9d1473b595b 100644 --- a/tests/ZalgoTest.php +++ b/tests/ZalgoTest.php @@ -3,16 +3,36 @@ // Copyright (c) ppy Pty Ltd . Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. +declare(strict_types=1); + namespace Tests; use Symfony\Component\Finder\Finder; class ZalgoTest extends TestCase { + public static function dataProviderForCombination() + { + return [ + ['👩🏻‍⚕️'], + ['再⃝'], + ['N⃝H⃝K⃝'], + ]; + } + + public static function dataProviderForUnzalgo() + { + return [ + ['testing', 0], + ['t͘e̎s̐ťi͛ñg̈́', 1], + ['t́͘e̎̀s̐̑ť̎i͛̋ñ̈́g̈́͡', 2], + ]; + } + /** - * @dataProvider combinationExamples + * @dataProvider dataProviderForCombination */ - public function testCombination($text) + public function testCombination(string $text) { $this->assertSame(unzalgo($text), $text); } @@ -32,30 +52,12 @@ public function testTranslations() /** * This does not seem like the best idea. * - * @dataProvider zalgoExamples + * @dataProvider dataProviderForUnzalgo */ - public function testUnzalgo($expected, $level) + public function testUnzalgo(string $expected, int $level) { $text = 't́̌͌̌͘e̎̀́͐̅s̐̑̈͋͡ť̎̅̌̅i͛̋̋͋̽ñ̈́̌̽̿g̈́̆͋͡͞'; $this->assertSame(unzalgo($text, $level), $expected); } - - public static function combinationExamples() - { - return [ - ['👩🏻‍⚕️'], - ['再⃝'], - ['N⃝H⃝K⃝'], - ]; - } - - public static function zalgoExamples() - { - return [ - ['testing', 0], - ['t͘e̎s̐ťi͛ñg̈́', 1], - ['t́͘e̎̀s̐̑ť̎i͛̋ñ̈́g̈́͡', 2], - ]; - } }