예제 #1
0
 /**
  * @test
  */
 public function dynamicPageAndDocumentTemplate_setPrototypeSizeFromDocumentTemplate()
 {
     //given
     $page = new DynamicPage();
     $page->setAttribute('document-template', $this->get200x200DocumentTemplate());
     //when
     $page->format($this->createDocument());
     //then
     $this->assertEquals(200, $page->getPrototypePage()->getWidth());
     $this->assertEquals(200, $page->getPrototypePage()->getHeight());
 }
예제 #2
0
 /**
  * @test
  */
 public function getUnorderedTasksFromPages()
 {
     $expectedTasks = new DrawingTaskHeap();
     $expectedTasks->insert(new DrawingTask(function () {
     }));
     $page = $this->getMockBuilder('PHPPdf\\Core\\Node\\Page')->setMethods(array('copy', 'collectUnorderedDrawingTasks'))->getMock();
     $page->expects($this->once())->method('copy')->will($this->returnValue($page));
     $page->expects($this->once())->method('collectUnorderedDrawingTasks')->will($this->returnValue($expectedTasks));
     $dynamicPage = new DynamicPage($page);
     $document = $this->createDocumentStub();
     $tasks = new DrawingTaskHeap();
     $dynamicPage->collectUnorderedDrawingTasks($document, $tasks);
     $this->assertEquals(0, count($tasks));
     $dynamicPage->createNextPage();
     $dynamicPage->collectUnorderedDrawingTasks($document, $tasks);
 }