Esempio n. 1
0
 /**
  * Static calls interface to allow calls such as green('hello');
  */
 public static function __callstatic($name, $params)
 {
     $knownColors = static::getKnownColors();
     $colorID = $knownColors[$name];
     $color = static::color($colorID);
     // target string is expected to be:
     $targetString = $params[0][0];
     $element = new TextElement($targetString);
     $element->setTextColor($color);
     return $element->render();
 }
Esempio n. 2
0
 public function testRender()
 {
     $textElement = new Output\TextElement('test TextElement');
     $style1 = new Mock\Matks\Vivian\Style\Style(1);
     $style2 = new Mock\Matks\Vivian\Style\Style(5);
     $textColor = new Mock\Matks\Vivian\Color\TextColor(33);
     $bgColor = new Mock\Matks\Vivian\Color\BackgroundColor(41);
     $textElement->setTextColor($textColor)->setBackgroundColor($bgColor)->addStyle($style1)->addStyle($style2);
     $output = $textElement->render();
     $expectedString = "test TextElement";
     $this->string($output)->isEqualTo($expectedString);
 }