diff --git a/src/Application/ParameterFinder.php b/src/Application/ParameterFinder.php index 2d5242e..1e5d62a 100644 --- a/src/Application/ParameterFinder.php +++ b/src/Application/ParameterFinder.php @@ -201,7 +201,7 @@ private function createReflection(PresenterComponentReflection $reflection, $com } return isset($subComponent) - ? $this->createReflection(new ClassType($class), $subComponent) + ? $this->createReflection(new PresenterComponentReflection($class), $subComponent) : new PresenterComponentReflection($class); } } diff --git a/tests/unit/src/Classes/TestComponent.php b/tests/unit/src/Classes/TestComponent.php index 6ffb1e9..710f5ef 100644 --- a/tests/unit/src/Classes/TestComponent.php +++ b/tests/unit/src/Classes/TestComponent.php @@ -25,4 +25,11 @@ final public function __construct() public function handleTestHandle(Class6 $handleEntity) { } + + /** + * @return TestComponent + */ + public function createComponentSub() + { + } } diff --git a/tests/unit/src/ParameterFinderTest.php b/tests/unit/src/ParameterFinderTest.php index 6523271..6142ed9 100644 --- a/tests/unit/src/ParameterFinderTest.php +++ b/tests/unit/src/ParameterFinderTest.php @@ -99,6 +99,22 @@ public function testComponent() ], $this->finder->getMapping($request)); } + public function testSubComponent() + { + $request = new Request('', 'GET', [ + 'action' => 'testAction', + 'do' => 'component-sub-testHandle', + 'component-sub-persistent' => 1, + ]); + $this->assertEquals([ + 'persistent1' => $this->createInfoObject('Tests\Unit\Classes\Class1', true), + 'actionEntity' => $this->createInfoObject('Tests\Unit\Classes\Class2', false), + 'component-sub-persistent' => $this->createInfoObject('Tests\Unit\Classes\Class5', true), + 'component-sub-handleEntity' => $this->createInfoObject('Tests\Unit\Classes\Class6', false), + 'persistent2' => $this->createInfoObject('string', true), + ], $this->finder->getMapping($request)); + } + public function testNamelessComponent() { $request = new Request('', 'GET', [