示例#1
0
 public function isIncomplete()
 {
     return $this->invoked_block->getAssertionCount() == 0;
 }
示例#2
0
文件: Block.php 项目: aaron-em/matura
 public function addToParent()
 {
     if ($this->parent_block) {
         $this->parent_block->addChild($this);
     }
 }
示例#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;
     }
 }
示例#4
0
function indent_width(Block $block, $per_level = 1)
{
    $level = $block->depth() - 1;
    return $level * $per_level;
}