/** * @param UnitCollection $base * @param UnitCollection $challenger */ public function compare(UnitCollection $base, UnitCollection $challenger) { foreach ($base as $baseUnit) { /* @var $baseUnit \RenanBr\PhpAct\Project\Unit */ $name = $baseUnit->getName(); if (!$challenger->has($name)) { $difference = new Difference('unit has been removed'); $this->populateDifference($difference, $baseUnit); $difference->addTag(Difference::BC_BREAK); $this->differences->add($difference); } } $unitComparator = new UnitComparator(); $unitComparator->setDifferences($this->differences); $unitComparator->setEventDispatcher($this->eventDispatcher); foreach ($challenger as $challengerUnit) { $name = $challengerUnit->getName(); if ($base->has($name)) { $unitComparator->compare($base->get($name), $challengerUnit); } else { $difference = new Difference('unit has been added'); $this->populateDifference($difference, $challengerUnit); $this->differences->add($difference); } } }
/** * @dataProvider constantSearcherProvider */ public function testConstantSearcher($expected, $name) { $constants = self::$units->get('\\StandardClass')->getConstants(); self::assertEquals($expected, $constants->has($name)); }