Esempio n. 1
0
 public function isIncomplete()
 {
     return $this->invoked_block->getAssertionCount() == 0;
 }
Esempio n. 2
0
 public function addToParent()
 {
     if ($this->parent_block) {
         $this->parent_block->addChild($this);
     }
 }
Esempio n. 3
0
 /**
  * Checks if the block or any of it's descendants match our grep filter or
  * do not match our except filter.
  *
  * Descendants are checked in order to retain a test even it's parent block
  * path does not match.
  */
 protected function isFiltered(Block $block)
 {
     // Skip filtering on implicit Suite block.
     if ($block instanceof Suite) {
         return false;
     }
     $options =& $this->options;
     $isFiltered = function ($block) use(&$options) {
         $filtered = false;
         if ($options['grep']) {
             $filtered = $filtered || preg_match($options['grep'], $block->path(0)) === 0;
         }
         if ($options['except']) {
             $filtered = $filtered || preg_match($options['except'], $block->path(0)) === 1;
         }
         return $filtered;
     };
     // Code smell. Consider moving this responsibility to the blocks.
     if ($block instanceof TestMethod) {
         return $isFiltered($block);
     } else {
         foreach ($block->tests() as $test) {
             if ($isFiltered($test) === false) {
                 return false;
             }
         }
         foreach ($block->describes() as $describe) {
             if ($this->isFiltered($describe) === false) {
                 return false;
             }
         }
         return true;
     }
 }
Esempio n. 4
0
function indent_width(Block $block, $per_level = 1)
{
    $level = $block->depth() - 1;
    return $level * $per_level;
}