/**
  * @depends testRenderPreviewForBuilder
  */
 public function testRenderPreviewForPredefined()
 {
     $emailTemplateId = 2;
     $expectedContent = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateId($emailTemplateId);
     $this->setGetArray(array('id' => $emailTemplateId));
     $content = $this->runControllerWithExitExceptionAndGetContent('emailTemplates/default/renderPreview');
     $this->assertEquals($expectedContent, $content);
 }
 public function actionRenderCanvas($id = null)
 {
     Yii::app()->clientScript->setToAjaxMode();
     // it would be empty for the first time during create so we just end the request here.
     if (empty($id)) {
         Yii::app()->end(0, false);
     }
     assert('is_int($id) || is_string($id)');
     $content = EmailTemplateSerializedDataToHtmlUtil::resolveHtmlByEmailTemplateId($id, true);
     Yii::app()->clientScript->render($content);
     echo $content;
 }