diff --git a/src/SlimController/SlimController.php b/src/SlimController/SlimController.php index 9ad2eab..303d99d 100644 --- a/src/SlimController/SlimController.php +++ b/src/SlimController/SlimController.php @@ -93,17 +93,14 @@ public function __construct(\Slim\Slim &$app) * @param string $template Name of the template to be rendererd * @param array $args Args for view */ - protected function render($template, $args = null) + protected function render($template, $args = array()) { - if (!is_null($args)) { - $this->app->view()->appendData($args); - } if (!is_null($this->renderTemplateSuffix) && !preg_match('/\.' . $this->renderTemplateSuffix . '$/', $template) ) { $template .= '.' . $this->renderTemplateSuffix; } - $this->app->render($template); + $this->app->render($template, $args); } /** diff --git a/tests/SlimController/Tests/SlimControllerTest.php b/tests/SlimController/Tests/SlimControllerTest.php index c91a9d7..3fdbdb6 100644 --- a/tests/SlimController/Tests/SlimControllerTest.php +++ b/tests/SlimController/Tests/SlimControllerTest.php @@ -50,17 +50,9 @@ public function testControllerConfigParamsAreUsed() public function testRenderingWorksFine() { $this->assertDefaultConstruction(); - $view = m::mock(); - $this->slim->shouldReceive('view') - ->once() - ->withNoArgs() - ->andReturn($view); - $view->shouldReceive('appendData') - ->once() - ->with(array('foo' => 'orotound', 'bar' => 'grandios')); $this->slim->shouldReceive('render') ->once() - ->with('rendertest.Suffix'); + ->with('rendertest.Suffix', array('foo' => 'orotound', 'bar' => 'grandios')); $controller = new TestController($this->slim); $controller->renderAction(); @@ -282,4 +274,4 @@ protected function assertDefaultConstruction($suffix = 'Suffix', $paramPrefix = ->andReturn($cleanupParams); } -} \ No newline at end of file +}