Пример #1
0
 public function setInfoWriter(atoum\writer $writer = null)
 {
     if ($writer === null) {
         $writer = new writers\std\out();
         $writer->addDecorator(new cli\colorizer('0;32'));
     }
     parent::setInfoWriter($writer);
     return $this;
 }
Пример #2
0
 public function testSetHelpWriter()
 {
     $this->if($script = new mock\script($name = uniqid()))->then->object($script->setHelpWriter($helpWriter = new writers\std\out()))->isIdenticalTo($script)->object($script->getHelpWriter())->isIdenticalTo($helpWriter)->given($labelColorizer = new atoum\cli\colorizer('0;32'), $labelColorizer->setPattern('/(^[^:]+: )/'), $argumentColorizer = new atoum\cli\colorizer('0;32'), $argumentColorizer->setPattern('/((?:^| )[-+]+[-a-z]+)/'), $valueColorizer = new atoum\cli\colorizer('0;34'), $valueColorizer->setPattern('/(<[^>]+>(?:\\.\\.\\.)?)/'), $defaultHelpWriter = new writers\std\out(), $defaultHelpWriter->addDecorator($labelColorizer)->addDecorator($valueColorizer)->addDecorator($argumentColorizer)->addDecorator(new writer\decorators\rtrim())->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear()))->then->object($script->setHelpWriter())->isIdenticalTo($script)->object($script->getHelpWriter())->isEqualTo($defaultHelpWriter);
 }
Пример #3
0
 public function testSetInfoWriter()
 {
     $this->given($runner = new testedClass(uniqid()))->then->object($runner->setInfoWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)->object($runner->getInfoWriter())->isIdenticalTo($errorWriter)->given($defaultInfoWriter = new atoum\writers\std\out(), $defaultInfoWriter->addDecorator(new writer\decorators\rtrim())->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear())->addDecorator(new cli\colorizer('0;32')))->then->object($runner->setInfoWriter())->isIdenticalTo($runner)->object($runner->getInfoWriter())->isEqualTo($defaultInfoWriter);
 }
Пример #4
0
 public function setHelpWriter(atoum\writer $writer = null)
 {
     if ($writer === null) {
         $labelColorizer = new cli\colorizer('0;32');
         $labelColorizer->setPattern('/(^[^:]+: )/');
         $argumentColorizer = new cli\colorizer('0;32');
         $argumentColorizer->setPattern('/((?:^| )[-+]+[-a-z]+)/');
         $valueColorizer = new cli\colorizer('0;34');
         $valueColorizer->setPattern('/(<[^>]+>(?:\\.\\.\\.)?)/');
         $writer = new writers\std\out();
         $writer->addDecorator($labelColorizer)->addDecorator($valueColorizer)->addDecorator($argumentColorizer)->addDecorator(new writer\decorators\rtrim())->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear());
     }
     $this->helpWriter = $writer;
     return $this;
 }