| @@ 46-64 (lines=19) @@ | ||
| 43 | $this->dompdfWrapper = new DompdfWrapper($this->dompdfFactory); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function testStreamHtml() |
|
| 47 | { |
|
| 48 | $input = "<h1>Foo</h1>Bar <b>baz</b><img src='img/foo'>"; |
|
| 49 | ||
| 50 | $this->dompdfFactory->expects($this->any()) |
|
| 51 | ->method('create') |
|
| 52 | ->will($this->returnValue($this->dompdf)); |
|
| 53 | ||
| 54 | $this->dompdf->expects($this->once()) |
|
| 55 | ->method('loadHtml') |
|
| 56 | ->with($this->equalTo($input)); |
|
| 57 | $this->dompdf->expects($this->once()) |
|
| 58 | ->method('render'); |
|
| 59 | $this->dompdf->expects($this->once()) |
|
| 60 | ->method('stream') |
|
| 61 | ->with($this->equalTo('file.pdf')); |
|
| 62 | ||
| 63 | $this->dompdfWrapper->streamHtml($input, 'file.pdf'); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testStreamHtmlWithImg() |
|
| 67 | { |
|
| @@ 88-106 (lines=19) @@ | ||
| 85 | $this->dompdfWrapper->streamHtml($input, 'file.pdf', array('tempDir' => 'bar')); |
|
| 86 | } |
|
| 87 | ||
| 88 | public function testGetPdf() |
|
| 89 | { |
|
| 90 | $input = "<h1>Foo</h1>Bar <b>baz</b><img src='img/foo'>"; |
|
| 91 | ||
| 92 | $this->dompdfFactory->expects($this->any()) |
|
| 93 | ->method('create') |
|
| 94 | ->will($this->returnValue($this->dompdf)); |
|
| 95 | ||
| 96 | $this->dompdf->expects($this->once()) |
|
| 97 | ->method('loadHtml') |
|
| 98 | ->with($this->equalTo($input)); |
|
| 99 | $this->dompdf->expects($this->once()) |
|
| 100 | ->method('render'); |
|
| 101 | $this->dompdf->expects($this->once()) |
|
| 102 | ->method('output') |
|
| 103 | ->willReturn('BINARY_CONTENT'); |
|
| 104 | ||
| 105 | $this->dompdfWrapper->getPdf($input, array('tempDir' => 'bar')); |
|
| 106 | } |
|
| 107 | } |
|
| 108 | ||