PhpSpec\Loader\Node\ExampleNode::markAsPending PHP Method

markAsPending() public method

public markAsPending ( boolean $isPending = true )
$isPending boolean
    public function markAsPending($isPending = true)
    {
        $this->isPending = $isPending;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @param string       $locator
  * @param integer|null $line
  *
  * @return Suite
  */
 public function load($locator, $line = null)
 {
     $suite = new Suite();
     foreach ($this->manager->locateResources($locator) as $resource) {
         if (!class_exists($resource->getSpecClassname()) && is_file($resource->getSpecFilename())) {
             require_once $resource->getSpecFilename();
         }
         if (!class_exists($resource->getSpecClassname())) {
             continue;
         }
         $reflection = new ReflectionClass($resource->getSpecClassname());
         if ($reflection->isAbstract()) {
             continue;
         }
         if (!$reflection->implementsInterface('PhpSpec\\SpecificationInterface')) {
             continue;
         }
         $spec = new Node\SpecificationNode($resource->getSrcClassname(), $reflection, $resource);
         foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
             if (!preg_match('/^(it|its)[^a-zA-Z]/', $method->getName())) {
                 continue;
             }
             if (null !== $line && !$this->lineIsInsideMethod($line, $method)) {
                 continue;
             }
             $example = new Node\ExampleNode(str_replace('_', ' ', $method->getName()), $method);
             if ($this->methodIsEmpty($method)) {
                 $example->markAsPending();
             }
             $spec->addExample($example);
         }
         $suite->addSpecification($spec);
     }
     return $suite;
 }