Ejemplo n.º 1
0
 public function testRenderTwoPartWithBorderAndPredifinedWidth()
 {
     // Arrange
     $renderer = new SvgRenderer(new GdWidthCalculator());
     $font = new Font(12, 'verdana', 'fonts/verdana.ttf');
     $badge = new Badge();
     $badge->setBorderRadius(3);
     $badge->addPart(new Part('text1', 'red', 'blue', $font, 100));
     $badge->addPart(new Part('text2', 'blue', 'red', $font, 200));
     // Act
     $result = $renderer->render($badge);
     // Assert
     $this->assertStringEqualsFile('tests/BadgeTestAsset/with-border-two-parts-predefined.svg', $result);
 }
Ejemplo n.º 2
0
 public function testAddPart()
 {
     // Arrange
     $badge = new Badge();
     $part = $this->getMockBuilder('PHP\\Badge\\Part')->disableOriginalConstructor()->getMock();
     // Act
     $badge->addPart($part);
     // Assert
     $this->assertCount(1, $badge->getParts());
     $this->assertEquals(array($part), $badge->getParts());
 }