Esempio n. 1
0
 /**
  * Execute the test along with any setup and tear down functions.
  *
  * @param  TestResult $result
  * @return void
  */
 public function run(TestResult $result)
 {
     $result->startTest($this);
     if ($this->getPending()) {
         $result->pendTest($this);
         return;
     }
     $this->executeTest($result);
     $result->endTest($this);
 }
 /**
  * Delegate test.pending message event to a Peridot TestResult.
  *
  * @param Test $test
  * @return void
  */
 public function onTestPending(Test $test)
 {
     $this->result->pendTest($test);
 }
Esempio n. 3
0
            $this->result->passTest($test);
            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("->getPendingCount()", function () {
        it("should return the pending count tracked by the result", function () {
            $result = new TestResult($this->eventEmitter);
            $pending = new Test("pending");
            $result->pendTest($pending);
            $count = $result->getPendingCount();
            assert($count == 1, "pending count should be 1");
        });
    });
});