Skip to content

Commit

Permalink
Add test for Util::getParameterClassName() (#54209)
Browse files Browse the repository at this point in the history
  • Loading branch information
amirmohammadnajmi authored Jan 15, 2025
1 parent 94cb92c commit 9ee1432
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Container/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Container\Util;
use PHPUnit\Framework\TestCase;
use ReflectionParameter;
use stdClass;

class UtilTest extends TestCase
Expand Down Expand Up @@ -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));
}
}

0 comments on commit 9ee1432

Please sign in to comment.