コード例 #1
0
ファイル: Context.php プロジェクト: brianium/peridot
 /**
  * Create a test and add it to the current suite
  *
  * @param $description
  * @param $fn
  */
 public function addTest($description, callable $fn = null, $pending = null)
 {
     $test = new Test($description, $fn);
     if (!is_null($pending)) {
         $test->setPending($pending);
     }
     $this->getCurrentSuite()->addTest($test);
     return $test;
 }
コード例 #2
0
         assert($emitted === $test, 'should have emitted test.passed event');
     });
 });
 describe("->pendTest()", function () {
     beforeEach(function () {
         $this->emitter = new EventEmitter();
         $this->result = new TestResult($this->emitter);
     });
     it('should emit a test.pending event', function () {
         $emitted = null;
         $this->emitter->on('test.pending', function ($test) use(&$emitted) {
             $emitted = $test;
         });
         $test = new Test('spec', function () {
         });
         $test->setPending(true);
         $this->result->pendTest($test);
         assert($emitted === $test, 'should have emitted test.pending event');
     });
 });
 describe('pending test accessors', function () {
     it('should allow access to the total number of pending tests', function () {
         $result = new TestResult($this->eventEmitter);
         $result->setPendingCount(1);
         assert($result->getPendingCount() === 1, 'should have returned pending count');
     });
 });
 describe('failure accessors', function () {
     it('should allow access to the total number of failures', function () {
         $result = new TestResult($this->eventEmitter);
         $result->setFailureCount(1);