Ejemplo n.º 1
0
 public function testSetGetHeight()
 {
     // Arrange
     $badge = new Badge();
     // Act
     $badge->setHeight(123);
     // Assert
     $this->assertInternalType('int', $badge->getHeight());
     $this->assertEquals(123, $badge->getHeight());
 }
Ejemplo n.º 2
0
 public function render(Badge $badge)
 {
     $width = 0;
     $height = $badge->getHeight();
     // Render the boxes, this will also calculate the width of the badge:
     $boxesMarkup = $this->renderBoxes($badge, $width);
     $result = '';
     $result .= sprintf('<svg xmlns="http://www.w3.org/2000/svg" width="%d" height="%d">', $width, $height);
     $result .= '<linearGradient id="gradient" x2="0" y2="100%">';
     $result .= '<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>';
     $result .= '<stop offset="1" stop-opacity=".1"/>';
     $result .= '</linearGradient>';
     $result .= $boxesMarkup;
     $result .= $this->renderLabels($badge);
     $result .= '</svg>';
     return $result;
 }