Peridot\Core\Suite::addTest PHP Method

addTest() public method

Add a test to the suite
public addTest ( Peridot\Core\TestInterface $test )
$test Peridot\Core\TestInterface
    public function addTest(TestInterface $test)
    {
        $test->setParent($this);
        $this->tests[] = $test;
    }

Usage Example

Beispiel #1
0
     $child->addTest($grandchild);
     $this->suite->addTest($child);
     $count = 0;
     $this->eventEmitter->on('suite.end', function () use(&$count) {
         $count++;
     });
     $this->runner->run(new TestResult($this->eventEmitter));
     assert(3 == $count, "expected 3 suite:end events to fire");
 });
 context("when configured to bail on failure", function () {
     it("should stop running on failure", function () {
         $suite = new Suite("suite", function () {
         });
         $passing = new Test("passing spec", function () {
         });
         $suite->addTest($passing);
         $childSuite = new Suite("child suite", function () {
         });
         $passingChild = new Test("passing child", function () {
         });
         $failingChild = new Test("failing child", function () {
             throw new Exception("booo");
         });
         $passing2Child = new Test("passing2 child", function () {
         });
         $childSuite->addTest($passingChild);
         $childSuite->addTest($failingChild);
         $childSuite->addTest($passing2Child);
         $suite->addTest($childSuite);
         $passing2 = new Test("passing2 spec", function () {
         });
All Usage Examples Of Peridot\Core\Suite::addTest