Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 public function testWrite()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->fopen = null)->and($adapter->fwrite = null)->and($stderr = new std\err($adapter))->then->object($stderr->write($string = uniqid()))->isIdenticalTo($stderr)->adapter($adapter)->call('fwrite')->withArguments(null, $string)->once()->object($stderr->write($string = uniqid() . "\n"))->isIdenticalTo($stderr)->adapter($adapter)->call('fwrite')->withArguments(null, $string)->once();
 }
Ejemplo n.º 3
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());
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
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);
 }