Example #1
0
         $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);
         assert($result->getFailureCount() === 1, 'should have returned failure count');
     });
 });
 describe('test count accessors', function () {
     it('should allow access to the total number of tests', function () {
         $result = new TestResult($this->eventEmitter);
         $result->setTestCount(1);
         assert($result->getTestCount() === 1, 'should have returned test count');
     });
Example #2
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");
        });
    });
});