From 3d0f2011242463c27448459ae6be52bd3429f063 Mon Sep 17 00:00:00 2001 From: Martin Herndl Date: Wed, 17 Nov 2021 21:55:14 +0100 Subject: [PATCH] Add shortcode_atts tests --- tests/DynamicReturnTypeExtensionTest.php | 1 + tests/data/shortcode_atts.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/data/shortcode_atts.php diff --git a/tests/DynamicReturnTypeExtensionTest.php b/tests/DynamicReturnTypeExtensionTest.php index d18c945..77c606a 100644 --- a/tests/DynamicReturnTypeExtensionTest.php +++ b/tests/DynamicReturnTypeExtensionTest.php @@ -20,6 +20,7 @@ public function dataFileAsserts(): iterable yield from $this->gatherAssertTypes(__DIR__ . '/data/get_object_taxonomies.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/get_post.php'); yield from $this->gatherAssertTypes(__DIR__ . '/data/mysql2date.php'); + yield from $this->gatherAssertTypes(__DIR__ . '/data/shortcode_atts.php'); } /** diff --git a/tests/data/shortcode_atts.php b/tests/data/shortcode_atts.php new file mode 100644 index 0000000..4296476 --- /dev/null +++ b/tests/data/shortcode_atts.php @@ -0,0 +1,17 @@ + '', 'bar' => ''], $atts)); +assertType('array{foo: string, bar: 19|string}', shortcode_atts(['foo' => 'foo-value', 'bar' => 19], $atts)); +assertType('array{foo: string|null, bar: 17|string, baz: string}', shortcode_atts(['foo' => null, 'bar' => 17, 'baz' => ''], $atts));