getConflicts() public method

The method {@link load()} needs to be called before calling this method, otherwise an exception is thrown.
public getConflicts ( ) : Puli\Manager\Api\Repository\PathConflict[]
return Puli\Manager\Api\Repository\PathConflict[] The conflicts.
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if (!$this->mapping->isLoaded()) {
         return;
     }
     $this->containingModule = $this->mapping->getContainingModule();
     // Remember the conflicts that will be adjusted during unload()
     foreach ($this->mapping->getConflicts() as $conflict) {
         $this->conflicts[$conflict->getRepositoryPath()] = $conflict;
         $this->conflictingMappings[$conflict->getRepositoryPath()] = $conflict->getMappings();
     }
     $moduleName = $this->containingModule->getName();
     $this->mappings->remove($this->mapping->getRepositoryPath(), $moduleName);
     foreach ($this->mapping->listRepositoryPaths() as $repositoryPath) {
         $this->mappingsByResource->remove($repositoryPath, $moduleName);
         $this->conflictDetector->release($repositoryPath, $moduleName);
     }
     // Unload after iterating, otherwise the paths are gone
     $this->mapping->unload();
 }
 public function testAddMappingIgnoresDuplicates()
 {
     $mapping = new PathMapping('/path', 'resources');
     $mapping->load($this->package1, $this->packages);
     $conflict = new PathConflict('/path/conflict');
     $this->assertCount(0, $mapping->getConflicts());
     $this->assertCount(0, $conflict->getMappings());
     $conflict->addMapping($mapping);
     $conflict->addMapping($mapping);
     $this->assertCount(1, $conflict->getMappings());
     $this->assertContains($mapping, $conflict->getMappings());
     $this->assertFalse($conflict->isResolved());
     $this->assertCount(1, $mapping->getConflicts());
     $this->assertContains($conflict, $mapping->getConflicts());
 }
Example #3
0
 public function testRemoveConflictIgnoresUnknownConflicts()
 {
     $mapping = new PathMapping('/path', 'resources');
     $mapping->load($this->package1, $this->packages);
     $conflict = new PathConflict('/path/conflict');
     $mapping->removeConflict($conflict);
     $this->assertCount(0, $mapping->getConflicts());
     $this->assertCount(0, $conflict->getMappings());
     $this->assertFalse($mapping->isConflicting());
 }