Skip to content

Commit

Permalink
Fix bug with sub-components
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Sep 21, 2016
1 parent 50709ff commit 0892d45
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Application/ParameterFinder.php
Expand Up @@ -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);
}
}
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/src/Classes/TestComponent.php
Expand Up @@ -25,4 +25,11 @@ final public function __construct()
public function handleTestHandle(Class6 $handleEntity)
{
}

/**
* @return TestComponent
*/
public function createComponentSub()
{
}
}
16 changes: 16 additions & 0 deletions tests/unit/src/ParameterFinderTest.php
Expand Up @@ -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', [
Expand Down

0 comments on commit 0892d45

Please sign in to comment.