/**
  * @param ConstantCollection $base
  * @param ConstantCollection $challenger
  */
 public function compare(ConstantCollection $base, ConstantCollection $challenger)
 {
     foreach ($base as $baseConstant) {
         /* @var $baseConstant \RenanBr\PhpAct\Project\Constant */
         $name = $baseConstant->getName();
         if (!$challenger->has($name) && !$this->mustSkip($baseConstant, null)) {
             $difference = new Difference('constant has been removed');
             $this->populateDifference($difference, $baseConstant);
             $difference->addTag(Difference::BC_BREAK);
             $this->differences->add($difference);
         }
     }
     $constantComparator = new ConstantComparator();
     $constantComparator->setDifferences($this->differences);
     foreach ($challenger as $challengerConstant) {
         /* @var $challengerConstant \RenanBr\PhpAct\Project\Constant */
         $name = $challengerConstant->getName();
         if ($base->has($name)) {
             $baseConstant = $base->get($name);
             if (!$this->mustSkip($baseConstant, $challengerConstant)) {
                 $constantComparator->compare($baseConstant, $challengerConstant);
             }
         } else {
             if (!$this->mustSkip(null, $challengerConstant)) {
                 $difference = new Difference('constant has been added');
                 $this->populateDifference($difference, $challengerConstant);
                 $this->differences->add($difference);
             }
         }
     }
 }
Beispiel #2
0
 /**
  * @dataProvider typeProvider
  */
 public function testType($expected, $name)
 {
     self::assertEquals($expected, self::$constants->get($name)->getType());
 }