예제 #1
0
 /**
  * @test
  * @dataProvider getsPositionTranslationProvider
  */
 public function getsPositionTranslation($position, $positionPoint, $firstPoint, $parentPosition, $parentPositionTranslation, $parentFirstPoint, $expectedPositionTranslation)
 {
     $this->node->setAttribute('position', $position);
     $this->node->setAttribute('left', $positionPoint[0]);
     $this->node->setAttribute('top', $positionPoint[1]);
     $boundary = $this->objectMother->getBoundaryStub($firstPoint[0], $firstPoint[1], 100, 100);
     $this->writeAttribute($this->node, 'boundary', $boundary);
     $parent = $this->getMockBuilder('PHPPdf\\Core\\Node\\Container')->setMethods(array('getPositionTranslation'))->getMock();
     $parent->setAttribute('position', $parentPosition);
     $parent->expects($this->any())->method('getPositionTranslation')->will($this->returnValue(Point::getInstance($parentPositionTranslation[0], $parentPositionTranslation[1])));
     $parentBoundary = $this->objectMother->getBoundaryStub($parentFirstPoint[0], $parentFirstPoint[1], 100, 100);
     $this->writeAttribute($parent, 'boundary', $parentBoundary);
     $this->node->setParent($parent);
     $page = new Page();
     $page->setHeight(self::PAGE_HEIGHT);
     $parent->setParent($page);
     $expectedPositionTranslation = Point::getInstance($expectedPositionTranslation[0], $expectedPositionTranslation[1]);
     $this->assertEquals($expectedPositionTranslation, $this->node->getPositionTranslation());
 }