/** * test that calling renderAs() more than once continues to work. * * @link #6466 * @return void */ public function testRenderAsCalledTwice() { $this->RequestHandler->renderAs($this->Controller, 'print'); $this->assertEquals('RequestHandlerTest' . DS . 'print', $this->Controller->viewPath); $this->assertEquals('print', $this->Controller->layoutPath); $this->RequestHandler->renderAs($this->Controller, 'js'); $this->assertEquals('RequestHandlerTest' . DS . 'js', $this->Controller->viewPath); $this->assertEquals('js', $this->Controller->layoutPath); }
/** * test that calling renderAs() more than once continues to work. * * @link #6466 * @return void */ public function testRenderAsCalledTwice() { $this->Controller->eventManager()->on('Controller.beforeRender', function (\Cake\Event\Event $e) { return $e->subject()->response; }); $this->Controller->render(); $this->RequestHandler->renderAs($this->Controller, 'print'); $this->assertEquals('RequestHandlerTest' . DS . 'print', $this->Controller->viewBuilder()->templatePath()); $this->assertEquals('print', $this->Controller->viewBuilder()->layoutPath()); $this->RequestHandler->renderAs($this->Controller, 'js'); $this->assertEquals('RequestHandlerTest' . DS . 'js', $this->Controller->viewBuilder()->templatePath()); $this->assertEquals('js', $this->Controller->viewBuilder()->layoutPath()); }