Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guenbakku committed Jul 27, 2017
2 parents 1f6bf22 + cbef400 commit 9c4c518
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public function add($html, $breakPage = false) {
* @return string|null: pdf content or null if output to file
*/
public function render($output = null, $options = array(), $overwrite = false) {
$this->output($output);
if ($output !== null) {
$this->output($output);
}
if (empty($this->output)) {
return $this->Snappy->getOutputFromHtml($this->html, $options);
} else {
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ public function testInstanceSnappy() {
$this->assertEquals($Snappy, $this->Pdf->getSnappy());
}

public function testOuput() {
$this->Pdf->add('<p>Test</p>');
$this->Pdf->output($this->output);
$this->Pdf->render();
$this->assertEquals(true, is_file($this->output));
}

public function testGenerateFileByAdd() {
$this->Pdf->add('<p>Test</p>');
$this->Pdf->render($this->output);
Expand Down

0 comments on commit 9c4c518

Please sign in to comment.