fixes
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
<?php
|
||||
|
||||
define('DOMPDF_ENABLE_AUTOLOAD', false);
|
||||
require_once __DIR__ . '/../vendor/dompdf/dompdf/dompdf_config.inc.php';
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
@@ -1,34 +1,54 @@
|
||||
<?php
|
||||
namespace Vsmoraes\Pdf;
|
||||
|
||||
class DompdfTest extends PHPUnit_Framework_TestCase
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DompdfTest extends TestCase
|
||||
{
|
||||
|
||||
public function testLoadHtml()
|
||||
{
|
||||
$stub = $this->getMockBuilder('\DOMPDF')
|
||||
->setMethods(['load_html'])
|
||||
$html = '<html><head></head><body></body></html>';
|
||||
$size = Pdf::DEFAULT_SIZE;
|
||||
$orientation = Pdf::DEFAULT_ORIENTATION;
|
||||
|
||||
$stub = $this->getMockBuilder(\Dompdf\Dompdf::class)
|
||||
->setMethods(['loadHtml', 'setPaper'])
|
||||
->getMock();
|
||||
|
||||
$pdf = new \Vsmoraes\Pdf\Dompdf($stub);
|
||||
$stub->expects($this->once())
|
||||
->method('loadHtml')
|
||||
->with($html);
|
||||
|
||||
$stub->expects($this->once())
|
||||
->method('load_html');
|
||||
->method('setPaper')
|
||||
->with($size, $orientation);
|
||||
|
||||
$pdf->load('<html><head></head><body></body></html>');
|
||||
$pdf = new Dompdf($stub);
|
||||
$result = $pdf->load($html);
|
||||
|
||||
$this->assertEquals($pdf, $result);
|
||||
}
|
||||
|
||||
public function testShowHtml()
|
||||
{
|
||||
$stub = $this->getMockBuilder('\DOMPDF')
|
||||
->getMock();
|
||||
$html = '<html><head></head><body></body></html>';
|
||||
$size = Pdf::DEFAULT_SIZE;
|
||||
$orientation = Pdf::DEFAULT_ORIENTATION;
|
||||
|
||||
$pdf = new \Vsmoraes\Pdf\Dompdf($stub);
|
||||
$stub = $this->getMockBuilder(\Dompdf\Dompdf::class)
|
||||
->setMethods(['setPaper', 'stream'])
|
||||
->getMock();
|
||||
|
||||
$stub->expects($this->once())
|
||||
->method('stream');
|
||||
|
||||
$pdf->load('<html><head></head><body></body></html>');
|
||||
$stub->expects($this->once())
|
||||
->method('setPaper')
|
||||
->with($size, $orientation);
|
||||
|
||||
$pdf = new Dompdf($stub);
|
||||
$pdf->load($html);
|
||||
$pdf->show();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user