Exemple #1
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);
 }
Exemple #2
0
 public function test__construct()
 {
     $this->if($runner = new scripts\runner($name = uniqid()))->then->string($runner->getName())->isEqualTo($name)->object($runner->getAdapter())->isInstanceOf('mageekguy\\atoum\\adapter')->object($runner->getLocale())->isInstanceOf('mageekguy\\atoum\\locale')->object($runner->getIncluder())->isInstanceOf('mageekguy\\atoum\\includer')->object($runner->getRunner())->isInstanceOf('mageekguy\\atoum\\runner')->variable($runner->getScoreFile())->isNull()->array($runner->getReports())->isEmpty()->array($runner->getArguments())->isEmpty()->array($runner->getHelp())->isEqualTo(array(array(array('-h', '--help'), null, 'Display this help'), array(array('-v', '--version'), null, 'Display version'), array(array('-p', '--php'), '<path/to/php/binary>', 'Path to PHP binary which must be used to run tests'), array(array('-drt', '--default-report-title'), '<string>', 'Define default report title with <string>'), array(array('-c', '--configurations'), '<file>...', 'Use all configuration files <file>'), array(array('-sf', '--score-file'), '<file>', 'Save score in file <file>'), array(array('-mcn', '--max-children-number'), '<integer>', 'Maximum number of sub-processus which will be run simultaneously'), array(array('-ncc', '--no-code-coverage'), null, 'Disable code coverage'), array(array('-nccid', '--no-code-coverage-in-directories'), '<directory>...', 'Disable code coverage in directories <directory>'), array(array('-nccfns', '--no-code-coverage-for-namespaces'), '<namespace>...', 'Disable code coverage for namespaces <namespace>'), array(array('-nccfc', '--no-code-coverage-for-classes'), '<class>...', 'Disable code coverage for classes <class>'), array(array('-f', '--files'), '<file>...', 'Execute all unit test files <file>'), array(array('-d', '--directories'), '<directory>...', 'Execute unit test files in all <directory>'), array(array('-tfe', '--test-file-extensions'), '<extension>...', 'Execute unit test files with one of extensions <extension>'), array(array('-g', '--glob'), '<pattern>...', 'Execute unit test files which match <pattern>'), array(array('-t', '--tags'), '<tag>...', 'Execute only unit test with tags <tag>'), array(array('-m', '--methods'), '<class::method>...', 'Execute all <class::method>, * may be used as wildcard for class name or method name'), array(array('-ns', '--namespaces'), '<namespace>...', 'Execute all classes in all namespaces <namespace>'), array(array('-l', '--loop'), null, 'Execute tests in an infinite loop'), array(array('--test-it'), null, 'Execute atoum unit tests'), array(array('--test-all'), null, 'Execute unit tests in directories defined via $script->addTestAllDirectory(\'path/to/directory\') in a configuration file'), array(array('-ft', '--force-terminal'), null, 'Force output as in terminal'), array(array('-bf', '--bootstrap-file'), '<file>', 'Include <file> before executing each test method'), array(array('-ulr', '--use-light-report'), null, 'Use "light" CLI report'), array(array('--debug'), null, 'Enable debug mode')))->if($runner = new scripts\runner($name = uniqid(), $adapter = new atoum\adapter()))->then->string($runner->getName())->isEqualTo($name)->object($runner->getAdapter())->isIdenticalTo($adapter)->object($runner->getLocale())->isInstanceOf('mageekguy\\atoum\\locale')->object($runner->getIncluder())->isInstanceOf('mageekguy\\atoum\\includer')->object($runner->getRunner())->isInstanceOf('mageekguy\\atoum\\runner')->variable($runner->getScoreFile())->isNull()->array($runner->getArguments())->isEmpty()->array($runner->getHelp())->isEqualTo(array(array(array('-h', '--help'), null, 'Display this help'), array(array('-v', '--version'), null, 'Display version'), array(array('-p', '--php'), '<path/to/php/binary>', 'Path to PHP binary which must be used to run tests'), array(array('-drt', '--default-report-title'), '<string>', 'Define default report title with <string>'), array(array('-c', '--configurations'), '<file>...', 'Use all configuration files <file>'), array(array('-sf', '--score-file'), '<file>', 'Save score in file <file>'), array(array('-mcn', '--max-children-number'), '<integer>', 'Maximum number of sub-processus which will be run simultaneously'), array(array('-ncc', '--no-code-coverage'), null, 'Disable code coverage'), array(array('-nccid', '--no-code-coverage-in-directories'), '<directory>...', 'Disable code coverage in directories <directory>'), array(array('-nccfns', '--no-code-coverage-for-namespaces'), '<namespace>...', 'Disable code coverage for namespaces <namespace>'), array(array('-nccfc', '--no-code-coverage-for-classes'), '<class>...', 'Disable code coverage for classes <class>'), array(array('-f', '--files'), '<file>...', 'Execute all unit test files <file>'), array(array('-d', '--directories'), '<directory>...', 'Execute unit test files in all <directory>'), array(array('-tfe', '--test-file-extensions'), '<extension>...', 'Execute unit test files with one of extensions <extension>'), array(array('-g', '--glob'), '<pattern>...', 'Execute unit test files which match <pattern>'), array(array('-t', '--tags'), '<tag>...', 'Execute only unit test with tags <tag>'), array(array('-m', '--methods'), '<class::method>...', 'Execute all <class::method>, * may be used as wildcard for class name or method name'), array(array('-ns', '--namespaces'), '<namespace>...', 'Execute all classes in all namespaces <namespace>'), array(array('-l', '--loop'), null, 'Execute tests in an infinite loop'), array(array('--test-it'), null, 'Execute atoum unit tests'), array(array('--test-all'), null, 'Execute unit tests in directories defined via $script->addTestAllDirectory(\'path/to/directory\') in a configuration file'), array(array('-ft', '--force-terminal'), null, 'Force output as in terminal'), array(array('-bf', '--bootstrap-file'), '<file>', 'Include <file> before executing each test method'), array(array('-ulr', '--use-light-report'), null, 'Use "light" CLI report'), array(array('--debug'), null, 'Enable debug mode')));
 }