public function testPassingValidHtmlToRenderAsString()
 {
     $model = new Html2PdfModel();
     $model->setTemplate('template00.phtml');
     $model->setDest('S');
     $this->renderer->resolver()->addPath('./test/_templates');
     $pdfContentAsString = $this->renderer->render($model);
     $this->assertStringStartsWith('%PDF', $pdfContentAsString);
 }
Exemplo n.º 2
0
 public function testMergeConstructorOptionsFromModel()
 {
     $model = new Html2PdfModel();
     $model->setDest('S');
     $model->setTemplate('template00.phtml');
     $model->setHtml2PdfOptions(['orientation' => 'L', 'format' => 'A3', 'lang' => 'pt', 'encoding' => 'ISO-8859-1', 'margins' => [5, 10, 20, 30]]);
     $this->renderer->resolver()->addPath('./test/_templates');
     $this->renderer->render($model);
     $html2pdfObject = $model->getVariable('html2pdf');
     $this->assertNotNull($html2pdfObject);
     $this->assertAttributeEquals('L', '_orientation', $html2pdfObject);
     $this->assertAttributeEquals('A3', '_format', $html2pdfObject);
     $this->assertAttributeEquals('pt', '_langue', $html2pdfObject);
     $this->assertAttributeEquals(true, '_unicode', $html2pdfObject);
     $this->assertAttributeEquals('ISO-8859-1', '_encoding', $html2pdfObject);
 }
 public function testGettersMustReturnTheAttributeValue()
 {
     $this->assertAttributeEquals($this->model->getFilename(), 'filename', $this->model);
     $this->assertAttributeEquals($this->model->getDest(), 'dest', $this->model);
 }