/**
* Tests that the Dompdf instance is being processed as expected.
*/
public function testDompdfControlFlow()
{
$engineClass = $this->getMockClass('\\CakePdf\\Pdf\\Engine\\DomPdfEngine', ['_createInstance']);
$Pdf = new CakePdf(['engine' => '\\' . $engineClass]);
$Pdf->engine()->expects($this->once())->method('_createInstance')->will($this->returnCallback(function ($options) {
$Dompdf = $this->getMock('\\Dompdf\\Dompdf', ['setPaper', 'loadHtml', 'render', 'output'], [$options]);
$Dompdf->expects($this->at(0))->method('setPaper')->with('A4', 'portrait');
$Dompdf->expects($this->at(1))->method('loadHtml')->with(null);
$Dompdf->expects($this->at(2))->method('render');
$Dompdf->expects($this->at(3))->method('output');
return $Dompdf;
}));
$Pdf->engine()->output();
}