/**
  * @test
  */
 public function itShouldCallScanAndNotWriteOnFailure()
 {
     $this->detector->scan($this->node)->shouldBeCalled()->willReturn(false);
     $this->detector->isBoolExpression($this->node)->shouldBeCalled()->willReturn(true);
     $this->analyser->foundAssumption(Argument::any(), Argument::any())->shouldNotBeCalled();
     $this->analyser->foundBoolExpression()->shouldBeCalled();
     $this->nodeVisitor->enterNode($this->node->reveal());
 }
示例#2
0
 /**
  * @param Node $node
  * @return false|null|Node|\PhpParser\Node[]|void
  */
 public function enterNode(Node $node)
 {
     if ($this->detector->isBoolExpression($node)) {
         $this->analyser->foundBoolExpression();
     }
     if ($this->detector->scan($node)) {
         $this->analyser->foundAssumption($node->getLine());
     }
 }
 /**
  * @test
  */
 public function itShouldDetectForAssumptions()
 {
     $node = $this->parser->parse('<?php for ($i = 0; $i; $i++);')[0];
     $this->assertTrue($this->detector->scan($node));
 }