From 9ee1432fbd531128156458a22d75c6f0dd4bd636 Mon Sep 17 00:00:00 2001 From: Amir Mohammad Najmi <71878858+amirmohammadnajmi@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:55:13 +0330 Subject: [PATCH] Add test for Util::getParameterClassName() (#54209) --- tests/Container/UtilTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Container/UtilTest.php b/tests/Container/UtilTest.php index b467e533432a..928e07ad8841 100644 --- a/tests/Container/UtilTest.php +++ b/tests/Container/UtilTest.php @@ -4,6 +4,7 @@ use Illuminate\Container\Util; use PHPUnit\Framework\TestCase; +use ReflectionParameter; use stdClass; class UtilTest extends TestCase @@ -40,4 +41,15 @@ public function testArrayWrap() $this->assertEquals([$obj], Util::arrayWrap($obj)); $this->assertSame($obj, Util::arrayWrap($obj)[0]); } + + public function testGetParameterClassName() + { + $parameter = new ReflectionParameter(function (stdClass $foo) { + }, 0); + $this->assertSame('stdClass', Util::getParameterClassName($parameter)); + + $parameter = new ReflectionParameter(function (string $foo) { + }, 0); + $this->assertNull(Util::getParameterClassName($parameter)); + } }