/** * Constructs a test Suite, assigning it the given title and anonymous * function. If it's a child of another suite, a reference to the parent * suite is stored. This is done by tracking the current and previously * defined suites. * After all, mark the Suit as pending. * * @param string $title A title to be associated with the suite * @param \Closure $closure The closure to invoke when the suite is ran */ public function xdescribe($title, \Closure $closure) { $previous = $this->current; $suite = new Suite($title, $closure, $previous); $suite->setPending(); // If current is null, this is the root suite for the file if ($this->current === null) { $this->suites[] = $suite; } else { $this->current->addSuite($suite); } $this->current = $suite; $suite->getClosure()->__invoke(); $this->current = $previous; }
/** * Adds a suite to the list of nested suites. * * @param Suite $suite The suite to add */ public function addSuite($suite) { if (true === $this->pending) { $suite->setPending(); } $this->suites[] = $suite; }