public function testGetOpponents() { $conflict = new PackageConflict('token', array('package1', 'package2')); $this->assertSame(array('package2'), $conflict->getOpponents('package1')); $this->assertSame(array('package1'), $conflict->getOpponents('package2')); $this->assertSame(array(), $conflict->getOpponents('package3')); }
public static function forPathConflict(PackageConflict $conflict, Exception $cause = null) { $packageNames = $conflict->getPackageNames(); $lastPackageName = array_pop($packageNames); return new static(sprintf('The packages "%s" and "%s" add resources for the same path ' . "\"%s\", but have no override order defined between them.\n\n" . "Resolutions:\n\n(1) Add the key \"override\" to the puli.json " . "of one package and set its value to the other package name.\n(2) " . 'Add the key "override-order" to the puli.json of the root ' . 'package and define the order of the packages there.', implode('", "', $packageNames), $lastPackageName, $conflict->getConflictingToken()), 0, $cause); }