Exemple #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     // normalize visibility
     $input->setOption('visibility', explode(',', $input->getOption('visibility')));
     $output->writeln('Welcome to ' . $this->getApplication()->getLongVersion());
     // initialize comparator with an empty difference collection
     $differences = new DifferenceCollection();
     $comparator = new UnitCollectionComparator();
     $comparator->setDifferences($differences);
     // inject filters
     $eventDispatcher = new EventEmitter();
     $this->injectVisibilityFilter($eventDispatcher);
     $comparator->setEventDispatcher($eventDispatcher);
     // materialize
     $project = $input->getArgument('project');
     $base = $input->getArgument('base');
     $challenger = $input->getArgument('challenger');
     $this->output->writeln('');
     $baseUnits = $this->materializeProject($project, $base)->getUnits();
     $this->output->writeln('');
     $challengerUnits = $this->materializeProject($project, $challenger)->getUnits();
     // compare
     $this->output->writeln('');
     $this->output->writeln('Comparing');
     $comparator->compare($baseUnits, $challengerUnits);
     // apply bc break filter
     $differences = $differences->filter(function (Difference $difference) {
         return !$this->input->getOption('bc-break-only') || $difference->hasTag(Difference::BC_BREAK);
     });
     $this->report($differences);
 }
Exemple #2
0
 /**
  * @param string $name
  * @return DifferenceCollection
  */
 protected static function loadDifferences($name)
 {
     self::$differences = new DifferenceCollection();
     $comparer = new UnitCollectionComparator();
     $comparer->setDifferences(self::$differences);
     $comparer->setEventDispatcher(new EventEmitter());
     $comparer->compare(self::getProject(__DIR__ . "/_assets/{$name}/base/build/index.xml")->getUnits(), self::getProject(__DIR__ . "/_assets/{$name}/challenger/build/index.xml")->getUnits());
 }