From be3979866e790df8d483df435fdde84b6ae8d371 Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 16 May 2023 10:47:13 +0100 Subject: [PATCH] Further baseline reduction and qa fixes --- phpcs.xml | 5 +++++ psalm-baseline.xml | 31 ------------------------------- test/Smoke/TestCase.php | 1 - test/Unit/QueryTest.php | 40 ++++++++++++++++++++++++++++------------ 4 files changed, 33 insertions(+), 44 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 25daefa..d8343ef 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -24,4 +24,9 @@ /test/ + + + + 0 + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 343455c..81c3dc8 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -5,35 +5,4 @@ withHttpResponse - - - assert(is_array($configured)) - assert(is_array($spec)) - is_array($configured) - is_array($spec) - - - null - - - is_array($content) - - - - null - - - MissingFile - - - - - $queries - $queries - - - ]]> - ]]> - - diff --git a/test/Smoke/TestCase.php b/test/Smoke/TestCase.php index c9871f5..44c7726 100644 --- a/test/Smoke/TestCase.php +++ b/test/Smoke/TestCase.php @@ -64,7 +64,6 @@ protected static function compileEndPoints(): array return $endpoints; } - /** @psalm-suppress MissingFile */ $content = require $configPath; if (! is_array($content)) { return $endpoints; diff --git a/test/Unit/QueryTest.php b/test/Unit/QueryTest.php index ccd932d..271a4bb 100644 --- a/test/Unit/QueryTest.php +++ b/test/Unit/QueryTest.php @@ -69,12 +69,20 @@ public static function queryProvider(): array /** @return array */ public static function defaultUrlProvider(): array { - $queries = self::queryProvider(); - $queries['Standard Form'][1] = 'https://example.com/api/v2?page=1&pageSize=20'; - $queries['Collection'][1] = sprintf('https://example.com?q=%s&page=1&pageSize=20', urlencode('[[:d = any(document.type, ["doc-type"])]]')); - $queries['With Query'][1] = 'https://example.com/?term=something&page=1&pageSize=20'; - - return $queries; + return [ + 'Standard Form' => [ + new Query(FormSpec::factory('everything', self::formData()->everything)), + 'https://example.com/api/v2?page=1&pageSize=20', + ], + 'With Query' => [ + new Query(FormSpec::factory('withQuery', self::formData()->withQuery)), + 'https://example.com/?term=something&page=1&pageSize=20', + ], + 'Collection' => [ + new Query(FormSpec::factory('collection', self::formData()->collection)), + sprintf('https://example.com?q=%s&page=1&pageSize=20', urlencode('[[:d = any(document.type, ["doc-type"])]]')), + ], + ]; } /** @dataProvider defaultUrlProvider */ @@ -86,12 +94,20 @@ public function testDefaultUrl(Query $query, string $expectedUrl): void /** @return array */ public static function queryUrlProvider(): array { - $queries = self::queryProvider(); - $queries['Standard Form'][1] = 'https://example.com/api/v2?page=1&pageSize=20&q=foo'; - $queries['Collection'][1] = sprintf('https://example.com?q=%s&q=foo&page=1&pageSize=20', urlencode('[[:d = any(document.type, ["doc-type"])]]')); - $queries['With Query'][1] = 'https://example.com/?term=something&page=1&pageSize=20&q=foo'; - - return $queries; + return [ + 'Standard Form' => [ + new Query(FormSpec::factory('everything', self::formData()->everything)), + 'https://example.com/api/v2?page=1&pageSize=20&q=foo', + ], + 'With Query' => [ + new Query(FormSpec::factory('withQuery', self::formData()->withQuery)), + 'https://example.com/?term=something&page=1&pageSize=20&q=foo', + ], + 'Collection' => [ + new Query(FormSpec::factory('collection', self::formData()->collection)), + sprintf('https://example.com?q=%s&q=foo&page=1&pageSize=20', urlencode('[[:d = any(document.type, ["doc-type"])]]')), + ], + ]; } /** @dataProvider queryUrlProvider */