Пример #1
0
 public function setWarningWriter(atoum\writer $writer = null)
 {
     if ($writer === null) {
         $writer = new writers\std\err();
         $colorizer = new cli\colorizer('0;33');
         $colorizer->setPattern('/^([^:]+:)/');
         $writer->addDecorator($colorizer);
     }
     parent::setWarningWriter($writer);
     return $this;
 }
Пример #2
0
 public function testSetErrorWriter()
 {
     $this->if($script = new mock\script($name = uniqid()))->then->object($script->setErrorWriter($errorWriter = new writers\std\out()))->isIdenticalTo($script)->object($script->getErrorWriter())->isIdenticalTo($errorWriter)->given($defaultErrorWriter = new writers\std\err(), $defaultErrorWriter->addDecorator(new writer\decorators\trim())->addDecorator(new writer\decorators\prompt($script->getLocale()->_('Error: ')))->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear()))->then->object($script->setErrorWriter())->isIdenticalTo($script)->object($script->getErrorWriter())->isNotIdenticalTo($errorWriter)->isEqualTo($defaultErrorWriter)->object($script->getErrorWriter()->getCli())->isIdenticalTo($script->getCli());
 }
Пример #3
0
 public function setErrorWriter(atoum\writer $writer = null)
 {
     if ($writer === null) {
         $writer = new writers\std\err($this->cli);
         $writer->addDecorator(new writer\decorators\trim())->addDecorator(new writer\decorators\prompt($this->locale->_('Error: ')))->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear());
     }
     $this->errorWriter = $writer;
     return $this;
 }
Пример #4
0
 public function testSetErrorWriter()
 {
     $this->given($runner = new testedClass(uniqid()))->then->object($runner->setErrorWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)->object($runner->getErrorWriter())->isIdenticalTo($errorWriter)->given($colorizer = new cli\colorizer('0;31'), $colorizer->setPattern('/^([^:]+:)/'), $defaultErrorWriter = new atoum\writers\std\err(), $defaultErrorWriter->addDecorator(new writer\decorators\trim())->addDecorator(new writer\decorators\prompt($runner->getLocale()->_('Error: ')))->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear())->addDecorator($colorizer))->then->object($runner->setErrorWriter())->isIdenticalTo($runner)->object($runner->getErrorWriter())->isEqualTo($defaultErrorWriter);
 }
Пример #5
0
 public function testSetErrorWriter()
 {
     $this->given($runner = new testedClass(uniqid()))->then->object($runner->setErrorWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)->object($runner->getErrorWriter())->isIdenticalTo($errorWriter)->given($colorizer = new cli\colorizer('0;31'))->and($colorizer->setPattern('/^([^:]+:)/'))->and($defaultErrorWriter = new atoum\writers\std\err())->and($defaultErrorWriter->addDecorator($colorizer))->then->object($runner->setErrorWriter())->isIdenticalTo($runner)->object($runner->getErrorWriter())->isEqualTo($defaultErrorWriter);
 }