コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $rootPackageName = $this->rootPackage->getName();
     $rootPackageFile = $this->rootPackage->getPackageFile();
     foreach ($this->mapping->getConflictingPackages() as $conflictingPackage) {
         $packageName = $conflictingPackage->getName();
         if (!$rootPackageFile->hasOverriddenPackage($packageName)) {
             $rootPackageFile->addOverriddenPackage($packageName);
             $this->overriddenPackages[] = $packageName;
         }
         if (!$this->overrideGraph->hasEdge($packageName, $rootPackageName)) {
             $this->overrideGraph->addEdge($packageName, $rootPackageName);
             $this->addedEdgesFrom[] = $packageName;
         }
     }
 }
コード例 #2
0
ファイル: OverrideGraphTest.php プロジェクト: kormik/manager
 public function testHasEdge()
 {
     $this->assertFalse($this->graph->hasEdge('p1', 'p2'));
     $this->assertFalse($this->graph->hasEdge('p2', 'p1'));
     $this->graph->addPackageName('p1');
     $this->graph->addPackageName('p2');
     $this->assertFalse($this->graph->hasEdge('p1', 'p2'));
     $this->assertFalse($this->graph->hasEdge('p2', 'p1'));
     $this->graph->addEdge('p1', 'p2');
     $this->assertTrue($this->graph->hasEdge('p1', 'p2'));
     $this->assertFalse($this->graph->hasEdge('p2', 'p1'));
 }
コード例 #3
0
 public function testConflictIfTransitiveOverrideOrder()
 {
     $this->detector->claim('A', 'package1');
     $this->detector->claim('A', 'package3');
     // Transitive relations ("paths") are not supported. Each pair of
     // conflicting packages must have a relationship defined. Otherwise,
     // if package2 removes the override statement for package1, then
     // package3 and package1 suddenly have a conflict without changing their
     // configuration
     $this->overrideGraph->addEdge('package1', 'package2');
     $this->overrideGraph->addEdge('package2', 'package3');
     $conflicts = $this->detector->detectConflicts(array('A'));
     $this->assertCount(1, $conflicts);
     $this->assertInstanceOf('Puli\\Manager\\Conflict\\PackageConflict', $conflicts[0]);
     $this->assertSame('A', $conflicts[0]->getConflictingToken());
     $this->assertSame(array('package1', 'package3'), $conflicts[0]->getPackageNames());
 }