/** * @test */ public function dontIgnorePaddingBottom() { $page = new Page(); $paddingBottom = 10; $leftFloatedContainerHeight = 20; $rightFloatedContainerHeight = 40; $containerHeight = $paddingBottom + $leftFloatedContainerHeight + $rightFloatedContainerHeight; $container = new Container(); $container->makeAttributesSnapshot(); $container->setPaddingBottom($paddingBottom); $container->setHeight($containerHeight); $container->setWidth($page->getWidth()); $this->invokeMethod($container, 'setBoundary', array($this->objectMother->getBoundaryStub(0, $page->getFirstPoint()->getY(), $page->getWidth(), $containerHeight))); $leftFloatedContainer = new Container(); $leftFloatedContainer->setFloat(Node::FLOAT_LEFT); $leftFloatedContainer->setHeight($leftFloatedContainerHeight); $leftFloatedContainer->setWidth(10); $this->invokeMethod($leftFloatedContainer, 'setBoundary', array($this->objectMother->getBoundaryStub(0, $page->getFirstPoint()->getY(), 10, $leftFloatedContainerHeight))); $rightFloatedContainer = new Container(); $rightFloatedContainer->setFloat(Node::FLOAT_RIGHT); $rightFloatedContainer->setHeight($rightFloatedContainerHeight); $rightFloatedContainer->setWidth(10); $this->invokeMethod($rightFloatedContainer, 'setBoundary', array($this->objectMother->getBoundaryStub(0, $page->getFirstPoint()->getY() + $leftFloatedContainerHeight, 10, $rightFloatedContainerHeight))); $page->add($container->add($leftFloatedContainer)->add($rightFloatedContainer)); $this->formatter->format($container, $this->document); $expectedHeight = $paddingBottom + $rightFloatedContainerHeight; $this->assertEquals($expectedHeight, $container->getHeight()); $this->assertEquals($expectedHeight, $container->getFirstPoint()->getY() - $container->getDiagonalPoint()->getY()); }
/** * @test * @dataProvider floatAndMarginProvider */ public function marginIsRespectedEvenIfNodeHasFloat($float, $marginLeft, $marginRight, $parentWidth, $width, $expectedXCoord) { $container = $this->getNodeMock(0, 500, $parentWidth, 500, array('getChildren'), false); $containerFloated = $this->getNodeMockWithFloatAndParent(0, 500, $width, 200, $float, $container); $containerFloated->setAttribute('margin-left', $marginLeft); $containerFloated->setAttribute('margin-right', $marginRight); $container->expects($this->atLeastOnce())->method('getChildren')->will($this->returnValue(array($containerFloated))); $this->formatter->format($container, $this->document); $this->assertEquals($expectedXCoord, $containerFloated->getFirstPoint()->getX()); }