From c9548fbe1d204bf7ffe53023d31b7447004ee04b Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Tue, 8 Oct 2024 20:57:04 -0400 Subject: [PATCH] minor: fix tests --- composer.json | 2 +- tests/NormalizationTest.php | 44 ++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index 1abf15f..8842d30 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "symfony/panther": "^1.1|^2.0.1", "symfony/phpunit-bridge": "^6.0|^7.0", "symfony/security-bundle": "^5.4|^6.0|^7.0", - "zenstruck/foundry": "^1.30" + "zenstruck/foundry": "^1.30,<1.35" }, "suggest": { "justinrainbow/json-schema": "Json schema validator. Needed to use Json::assertMatchesSchema().", diff --git a/tests/NormalizationTest.php b/tests/NormalizationTest.php index ffd4e19..5a97619 100644 --- a/tests/NormalizationTest.php +++ b/tests/NormalizationTest.php @@ -42,8 +42,8 @@ public static function namesProvider(): \Generator $baseTemplate = 'error_'.__METHOD__; yield 'test name without datasets' => [ - 'test name' => __METHOD__, - 'expected output' => \strtr($baseTemplate, '\\:', '-_').'__0', + 'testName' => __METHOD__, + 'expectedOutput' => \strtr($baseTemplate, '\\:', '-_').'__0', ]; $datasetTemplate = $baseTemplate.'__data-set-%s__0'; @@ -55,20 +55,20 @@ public static function namesProvider(): \Generator $numericOutput = \strtr($numericTemplate, '\\:', '-_'); yield 'phpunit 10 alpha' => [ - 'test name' => __METHOD__.' with data set "test set"', - 'expected output' => $alphaOutput, + 'testName' => __METHOD__.' with data set "test set"', + 'expectedOutput' => $alphaOutput, ]; yield 'phpunit 10 numeric' => [ - 'test name' => __METHOD__.' with data set #0', - 'expected output' => $numericOutput, + 'testName' => __METHOD__.' with data set #0', + 'expectedOutput' => $numericOutput, ]; yield 'legacy alpha' => [ - 'test name' => __METHOD__.' with data set "test set" (test set)', - 'expected output' => $alphaOutput, + 'testName' => __METHOD__.' with data set "test set" (test set)', + 'expectedOutput' => $alphaOutput, ]; yield 'legacy numeric' => [ - 'test name' => __METHOD__.' with data set #0 (test set)', - 'expected output' => $numericOutput, + 'testName' => __METHOD__.' with data set #0 (test set)', + 'expectedOutput' => $numericOutput, ]; } @@ -76,28 +76,28 @@ public static function edgeCaseTestNames(): \Generator { $baseTemplate = \strtr('error_'.__METHOD__.'__data-set-', '\\:', '-_'); yield 'self within moustache' => [ - 'test name' => __METHOD__.' with data set "te{{self}}st" (test set)', - 'expected output' => $baseTemplate.'te-self-st__0', + 'testName' => __METHOD__.' with data set "te{{self}}st" (test set)', + 'expectedOutput' => $baseTemplate.'te-self-st__0', ]; yield 'double quoted with space' => [ - 'test name' => __METHOD__.' with data set "_self.env.setCache("uri://host.net:2121") _self.env.loadTemplate("other-host")" (test set)', - 'expected output' => $baseTemplate.'_self-env-setCache-uri-host-net-2121-_self-env-loadTemplate-other-host-__0', + 'testName' => __METHOD__.' with data set "_self.env.setCache("uri://host.net:2121") _self.env.loadTemplate("other-host")" (test set)', + 'expectedOutput' => $baseTemplate.'_self-env-setCache-uri-host-net-2121-_self-env-loadTemplate-other-host-__0', ]; yield 'double quotes in moustache' => [ - 'test name' => __METHOD__.' with data set "te{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}st"', - 'expected output' => $baseTemplate.'te-_self-env-registerUndefinedFilterCallback-exec-_self-env-getFilter-id-st__0', + 'testName' => __METHOD__.' with data set "te{{_self.env.registerUndefinedFilterCallback("exec")}}{{_self.env.getFilter("id")}}st"', + 'expectedOutput' => $baseTemplate.'te-_self-env-registerUndefinedFilterCallback-exec-_self-env-getFilter-id-st__0', ]; yield 'escaped simple quote' => [ - 'test name' => __METHOD__.' with data set "te{{\'/etc/passwd\'|file_excerpt(1,30)}}st"', - 'expected output' => $baseTemplate.'te-etc-passwd-file_excerpt-1-30-st__0', + 'testName' => __METHOD__.' with data set "te{{\'/etc/passwd\'|file_excerpt(1,30)}}st"', + 'expectedOutput' => $baseTemplate.'te-etc-passwd-file_excerpt-1-30-st__0', ]; yield 'single quote for array index access' => [ - 'test name' => __METHOD__.' with data set "te{{[\'id\']|filter(\'system\')}}st"', - 'expected output' => $baseTemplate.'te-id-filter-system-st__0', + 'testName' => __METHOD__.' with data set "te{{[\'id\']|filter(\'system\')}}st"', + 'expectedOutput' => $baseTemplate.'te-id-filter-system-st__0', ]; yield 'numeric array access' => [ - 'test name' => __METHOD__.' with data set "te{{[0]|reduce(\'system\',\'id\')}}st"', - 'expected output' => $baseTemplate.'te-0-reduce-system-id-st__0', + 'testName' => __METHOD__.' with data set "te{{[0]|reduce(\'system\',\'id\')}}st"', + 'expectedOutput' => $baseTemplate.'te-0-reduce-system-id-st__0', ]; } }