Beispiel #1
0
 public function testAutorun()
 {
     $this->if($script = new testedClass(uniqid()))->and($script->setAdapter($adapter = new atoum\test\adapter()))->and($adapter->realpath = function ($path) {
         return $path;
     })->when(function () {
         if (isset($_SERVER['argv']) === true) {
             unset($_SERVER['argv']);
         }
     })->then->boolean($script->autorun())->isTrue()->if($_SERVER['argv'] = array())->then->boolean($script->autorun())->isTrue()->if($_SERVER['argv'][0] = $script->getName())->then->boolean($script->autorun())->isFalse()->if($adapter->realpath = uniqid())->then->boolean($script->autorun())->isTrue();
 }
Beispiel #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')));
 }