예제 #1
0
    });
    describe('->setScope()', function () {
        it('should set the scope of the test', function () {
            $scope = new Scope();
            $test = new Test("spec", function () {
            });
            $test->setScope($scope);
            assert($scope === $test->getScope(), "setScope should have set scope");
        });
    });
    describe('->setParent()', function () {
        it('should bind the parent scope to the child', function () {
            $scope = new Scope();
            $parent = new Suite("parent", function () {
            });
            $parent->setScope($scope);
            $test = new Test("child", function () {
            });
            $test->setParent($parent);
            assert($scope === $test->getScope(), "scope should be parent scope");
        });
    });
    describe('file accessors', function () {
        it('should allow access to the file property', function () {
            $test = new Test('test');
            $test->setFile(__FILE__);
            $file = $test->getFile();
            assert($file === __FILE__);
        });
    });
});
예제 #2
0
 /**
  * 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 ($pending !== null) {
         $test->setPending($pending);
     }
     $test->setFile($this->file);
     $this->getCurrentSuite()->addTest($test);
     return $test;
 }