Skip to content

Commit

Permalink
When setting the controller name, we also set the modelClass property…
Browse files Browse the repository at this point in the history
… in order for the magic get property to properly load the Model associated to the controller being invoked
  • Loading branch information
HavokInspiration committed Sep 22, 2017
1 parent c9aac48 commit 813800f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Controller/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function getControllerName()
public function setControllerName(string $controllerName) : Action
{
$this->controllerName = $controllerName;
$this->modelClass = $controllerName;

return $this;
}
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/Http/ActionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function testApplicationAction()
$this->assertInstanceOf('TestApp\Controller\Cakes\IndexAction', $result);
$this->assertEquals('Index', $result->name);
$this->assertEquals('Cakes', $result->getControllerName());
$this->assertEquals('Cakes', $result->modelClass);
$this->assertSame($request, $result->request);
$this->assertSame($this->response, $result->response);
}
Expand Down

0 comments on commit 813800f

Please sign in to comment.