Пример #1
0
 /**
  * After an it() spec we need to tear down the test case.
  *
  * @param Spec $spec
  */
 public function afterSpec(Spec $spec)
 {
     $time = 0;
     if ($spec->isFailed()) {
         self::$result->addFailure(self::$test, new PHPUnit_Framework_AssertionFailedError($spec->exception), $time);
     } elseif ($spec->isIncomplete()) {
         self::$result->addFailure(self::$test, new PHPUnit_Framework_IncompleteTestError($spec->exception), $time);
     }
     self::$testCase->tearDown();
     self::$result->endTest(self::$test, $time);
 }
Пример #2
0
 /**
  * Ran after an individual spec. May be used to display the results of that
  * particular spec.
  *
  * @param Spec $spec The spec after which to run this method
  */
 public function afterSpec(Spec $spec)
 {
     if ($spec->isFailed()) {
         $this->failedSpecs[] = $spec;
         $this->console->writeLn("##teamcity[testFailed name='" . $spec . "' message='" . $this->formatter->red('failed') . "' details='" . str_replace("\n", ' ', $spec->exception) . "']");
     } else {
         if ($spec->isIncomplete()) {
             $this->incompleteSpecs[] = $spec;
         } else {
             if ($spec->isPending()) {
                 $this->pendingSpecs[] = $spec;
             }
         }
     }
     $this->console->writeLn("##teamcity[testFinished name='" . $spec . "']");
 }
Пример #3
0
 /**
  * Ran after an individual spec. May be used to display the results of that
  * particular spec.
  *
  * @param Spec $spec The spec after which to run this method
  */
 public function afterSpec(Spec $spec)
 {
     if ($spec->isFailed()) {
         $this->failedSpecs[] = $spec;
         $title = $this->formatter->red($spec);
     } else {
         if ($spec->isIncomplete()) {
             $this->incompleteSpecs[] = $spec;
             $title = $this->formatter->cyan($spec);
         } else {
             if ($spec->isPending()) {
                 $this->pendingSpecs[] = $spec;
                 $title = $this->formatter->yellow($spec);
             } else {
                 $title = $this->formatter->grey($spec);
             }
         }
     }
     $this->console->writeLn($title);
 }
Пример #4
0
 /**
  * Ran after an individual spec. May be used to display the results of that
  * particular spec.
  *
  * @param Spec $spec The spec after which to run this method
  */
 public function afterSpec(Spec $spec)
 {
     $leftPad = str_repeat(' ', self::TAB_SIZE * $this->depth);
     if ($spec->isFailed()) {
         $this->failedSpecs[] = $spec;
         $title = $this->formatter->red($spec->getTitle());
     } else {
         if ($spec->isIncomplete()) {
             $this->incompleteSpecs[] = $spec;
             $title = $this->formatter->cyan($spec->getTitle());
         } else {
             if ($spec->isPending()) {
                 $this->pendingSpecs[] = $spec;
                 $title = $this->formatter->yellow($spec->getTitle());
             } else {
                 $title = $this->formatter->grey($spec->getTitle());
             }
         }
     }
     $this->console->writeLn($leftPad . $title);
 }
Пример #5
0
 /**
  * Ran after an individual spec.
  *
  * @param Spec $spec The spec after which to run this method
  */
 public function afterSpec(Spec $spec)
 {
     $this->lineLength += 1;
     if ($spec->isFailed()) {
         $this->failedSpecs[] = $spec;
         $failure = $this->formatter->red('F');
         $this->console->write($failure);
     } else {
         if ($spec->isIncomplete()) {
             $this->incompleteSpecs[] = $spec;
             $incomplete = $this->formatter->cyan('I');
             $this->console->write($incomplete);
         } else {
             if ($spec->isPending()) {
                 $this->pendingSpecs[] = $spec;
                 $pending = $this->formatter->yellow('P');
                 $this->console->write($pending);
             } else {
                 $this->console->write('.');
             }
         }
     }
 }
Пример #6
0
         expect($spec->isPassed())->toBe(false);
     });
 });
 describe('isFailed', function () {
     it('returns true when the spec failed', function () {
         $spec = new Spec('SpecTitle', function () {
             throw new Exception('failed');
         }, $this->suite);
         $spec->run();
         expect($spec->isFailed())->toBe(true);
     });
     it('returns false when the spec did not fail', function () {
         $spec = new Spec('SpecTitle', function () {
         }, $this->suite);
         $spec->run();
         expect($spec->isFailed())->toBe(false);
     });
 });
 describe('isIncomplete', function () {
     it('returns true when the spec is incomplete', function () {
         $spec = new Spec('SpecTitle', null, $this->suite);
         $spec->run();
         expect($spec->isIncomplete())->toBe(true);
     });
     it('returns false when the spec is not incomplete', function () {
         $spec = new Spec('SpecTitle', function () {
         }, $this->suite);
         $spec->run();
         expect($spec->isIncomplete())->toBe(false);
     });
 });