示例#1
0
文件: cli.php 项目: xihewang/atoum
 public function __construct()
 {
     parent::__construct();
     $defaultColorizer = new colorizer('1;36');
     $firstLevelPrompt = new prompt('> ');
     $secondLevelPrompt = new prompt('=> ', $defaultColorizer);
     $thirdLevelPrompt = new prompt('==> ', $defaultColorizer);
     $atoumPathField = new runner\atoum\path\cli();
     $atoumPathField->setPrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($atoumPathField);
     $atoumVersionField = new runner\atoum\version\cli();
     $atoumVersionField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($atoumVersionField);
     $phpPathField = new runner\php\path\cli();
     $phpPathField->setPrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($phpPathField);
     $phpVersionField = new runner\php\version\cli();
     $phpVersionField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer)->setVersionPrompt($secondLevelPrompt);
     $this->addField($phpVersionField);
     $runnerTestsDurationField = new runner\tests\duration\cli();
     $runnerTestsDurationField->setPrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($runnerTestsDurationField);
     $runnerTestsMemoryField = new runner\tests\memory\cli();
     $runnerTestsMemoryField->setPrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($runnerTestsMemoryField);
     $this->runnerTestsCoverageField = new runner\tests\coverage\cli();
     $this->runnerTestsCoverageField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer)->setClassPrompt($secondLevelPrompt)->setMethodPrompt(new prompt('==> ', $defaultColorizer));
     $this->addField($this->runnerTestsCoverageField);
     $runnerDurationField = new runner\duration\cli();
     $runnerDurationField->setPrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer);
     $this->addField($runnerDurationField);
     $runnerResultField = new runner\result\cli();
     $runnerResultField->setSuccessColorizer(new colorizer('0;37', '42'))->setFailureColorizer(new colorizer('0;37', '41'));
     $this->addField($runnerResultField);
     $failureColorizer = new colorizer('0;31');
     $failurePrompt = clone $secondLevelPrompt;
     $failurePrompt->setColorizer($failureColorizer);
     $runnerFailuresField = new runner\failures\cli();
     $runnerFailuresField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($failureColorizer)->setMethodPrompt($failurePrompt);
     $this->addField($runnerFailuresField);
     $runnerOutputsField = new runner\outputs\cli();
     $runnerOutputsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($defaultColorizer)->setMethodPrompt($secondLevelPrompt);
     $this->addField($runnerOutputsField);
     $errorColorizer = new colorizer('0;33');
     $errorMethodPrompt = clone $secondLevelPrompt;
     $errorMethodPrompt->setColorizer($errorColorizer);
     $errorPrompt = clone $thirdLevelPrompt;
     $errorPrompt->setColorizer($errorColorizer);
     $runnerErrorsField = new runner\errors\cli();
     $runnerErrorsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($errorColorizer)->setMethodPrompt($errorMethodPrompt)->setErrorPrompt($errorPrompt);
     $this->addField($runnerErrorsField);
     $exceptionColorizer = new colorizer('0;35');
     $exceptionMethodPrompt = clone $secondLevelPrompt;
     $exceptionMethodPrompt->setColorizer($exceptionColorizer);
     $exceptionPrompt = clone $thirdLevelPrompt;
     $exceptionPrompt->setColorizer($exceptionColorizer);
     $runnerExceptionsField = new runner\exceptions\cli();
     $runnerExceptionsField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($exceptionColorizer)->setMethodPrompt($exceptionMethodPrompt)->setExceptionPrompt($exceptionPrompt);
     $this->addField($runnerExceptionsField);
     $uncompletedTestColorizer = new colorizer('0;37');
     $uncompletedTestMethodPrompt = clone $secondLevelPrompt;
     $uncompletedTestMethodPrompt->setColorizer($uncompletedTestColorizer);
     $uncompletedTestOutputPrompt = clone $thirdLevelPrompt;
     $uncompletedTestOutputPrompt->setColorizer($uncompletedTestColorizer);
     $runnerUncompletedField = new runner\tests\uncompleted\cli();
     $runnerUncompletedField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($uncompletedTestColorizer)->setMethodPrompt($uncompletedTestMethodPrompt)->setOutputPrompt($uncompletedTestOutputPrompt);
     $this->addField($runnerUncompletedField);
     $voidTestColorizer = new colorizer('0;34');
     $voidTestMethodPrompt = clone $secondLevelPrompt;
     $voidTestMethodPrompt->setColorizer($voidTestColorizer);
     $runnerVoidField = new runner\tests\void\cli();
     $runnerVoidField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($voidTestColorizer)->setMethodPrompt($voidTestMethodPrompt);
     $this->addField($runnerVoidField);
     $skippedTestColorizer = new colorizer('0;90');
     $skippedTestMethodPrompt = clone $secondLevelPrompt;
     $skippedTestMethodPrompt->setColorizer($skippedTestColorizer);
     $runnerSkippedField = new runner\tests\skipped\cli();
     $runnerSkippedField->setTitlePrompt($firstLevelPrompt)->setTitleColorizer($skippedTestColorizer)->setMethodPrompt($skippedTestMethodPrompt);
     $this->addField($runnerSkippedField);
     $testRunField = new test\run\cli();
     $testRunField->setPrompt($firstLevelPrompt)->setColorizer($defaultColorizer);
     $this->addField($testRunField);
     $this->addField(new test\event\cli());
     $testDurationField = new test\duration\cli();
     $testDurationField->setPrompt($secondLevelPrompt);
     $this->addField($testDurationField);
     $testMemoryField = new test\memory\cli();
     $testMemoryField->SetPrompt($secondLevelPrompt);
     $this->addField($testMemoryField);
 }
示例#2
0
文件: cli.php 项目: xihewang/atoum
 public function test__construct()
 {
     $this->define($atoumPathField = new fields\runner\atoum\path\cli())->and($atoumPathField->setPrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($atoumVersionField = new fields\runner\atoum\version\cli())->and($atoumVersionField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($phpPathField = new fields\runner\php\path\cli())->and($phpPathField->setPrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($phpVersionField = new fields\runner\php\version\cli())->and($phpVersionField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36'))->setVersionPrompt(new prompt('=> ', new colorizer('1;36'))))->define($runnerTestsDurationField = new fields\runner\tests\duration\cli())->and($runnerTestsDurationField->setPrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($runnerTestsMemoryField = new fields\runner\tests\memory\cli())->and($runnerTestsMemoryField->setPrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($runnerTestsCoverageField = new fields\runner\tests\coverage\cli())->and($runnerTestsCoverageField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36'))->setClassPrompt(new prompt('=> ', new colorizer('1;36')))->setMethodPrompt(new prompt('==> ', new colorizer('1;36'))))->define($runnerDurationField = new fields\runner\duration\cli())->and($runnerDurationField->setPrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36')))->define($runnerResultField = new fields\runner\result\cli())->and($runnerResultField->setSuccessColorizer(new colorizer('0;37', '42'))->setFailureColorizer(new colorizer('0;37', '41')))->define($runnerFailuresField = new fields\runner\failures\cli())->and($runnerFailuresField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;31'))->setMethodPrompt(new prompt('=> ', new colorizer('0;31'))))->define($runnerOutputsField = new fields\runner\outputs\cli())->and($runnerOutputsField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('1;36'))->setMethodPrompt(new prompt('=> ', new colorizer('1;36'))))->define($runnerErrorsField = new fields\runner\errors\cli())->and($runnerErrorsField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;33'))->setMethodPrompt(new prompt('=> ', new colorizer('0;33')))->setErrorPrompt(new prompt('==> ', new colorizer('0;33'))))->define($runnerExceptionsField = new fields\runner\exceptions\cli())->and($runnerExceptionsField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;35'))->setMethodPrompt(new prompt('=> ', new colorizer('0;35')))->setExceptionPrompt(new prompt('==> ', new colorizer('0;35'))))->define($runnerUncompletedField = new fields\runner\tests\uncompleted\cli())->and($runnerUncompletedField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;37'))->setMethodPrompt(new prompt('=> ', new colorizer('0;37')))->setOutputPrompt(new prompt('==> ', new colorizer('0;37'))))->define($runnerVoidField = new fields\runner\tests\void\cli())->and($runnerVoidField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;34'))->setMethodPrompt(new prompt('=> ', new colorizer('0;34'))))->define($runnerSkippedField = new fields\runner\tests\skipped\cli())->and($runnerSkippedField->setTitlePrompt(new prompt('> '))->setTitleColorizer(new colorizer('0;90'))->setMethodPrompt(new prompt('=> ', new colorizer('0;90'))))->define($testRunField = new fields\test\run\cli())->and($testRunField->setPrompt(new prompt('> '))->setColorizer(new colorizer('1;36')))->define($testDurationField = new fields\test\duration\cli())->and($testDurationField->setPrompt(new prompt('=> ', new colorizer('1;36'))))->define($testMemoryField = new fields\test\memory\cli())->and($testMemoryField->setPrompt(new prompt('=> ', new colorizer('1;36'))))->if($report = new testedClass())->then->object($report->getLocale())->isEqualTo(new atoum\locale())->object($report->getAdapter())->isEqualTo(new atoum\adapter())->array($report->getFields())->isEqualTo(array($atoumPathField, $atoumVersionField, $phpPathField, $phpVersionField, $runnerTestsDurationField, $runnerTestsMemoryField, $runnerTestsCoverageField, $runnerDurationField, $runnerResultField, $runnerFailuresField, $runnerOutputsField, $runnerErrorsField, $runnerExceptionsField, $runnerUncompletedField, $runnerVoidField, $runnerSkippedField, $testRunField, new fields\test\event\cli(), $testDurationField, $testMemoryField));
 }