예제 #1
0
         assert($removed === null, 'cannot remove node that is not child');
     });
     it('should be possible through parent references', function () {
         $first = new Test('child 1');
         $second = new Test('child 2');
         $this->node->setChildNodes([$first, $second]);
         $removed = $first->getParent()->removeNode($first);
         assert($removed === $first, 'should have returned removed node');
         assert(count($this->node->getChildNodes()) === 1, 'size should reflect removed node');
     });
 });
 describe('->walk()', function () {
     it('should walk a hierarchy', function () {
         $childSuite = new Suite('child suite');
         $grandChildTest = new Test(' grand child');
         $childSuite->addChildNode($grandChildTest);
         $this->node->addChildNode($childSuite);
         $joined = '';
         $this->node->walk(function (TestInterface $test) use(&$joined) {
             $joined .= $test->getDescription();
         });
         assert($joined === 'child suite grand child');
     });
 });
 describe('->filter()', function () {
     beforeEach(function () {
         $this->fast = new Test('should run @fast');
         $this->slow1 = new Test('should run @slow');
         $this->slow2 = new Test('should also be @slow');
         $this->node->setChildNodes([$this->fast, $this->slow1, $this->slow2]);
     });