/** * Removes a conflict from the mapping. * * The method {@link load()} needs to be called before calling this method, * otherwise an exception is thrown. * * @param PathConflict $conflict The conflict to remove. * * @throws NotLoadedException If the mapping is not loaded. */ public function removeConflict(PathConflict $conflict) { if (null === $this->state) { throw new NotLoadedException('The mapping is not loaded.'); } $repositoryPath = $conflict->getRepositoryPath(); if (!isset($this->conflicts[$repositoryPath]) || $conflict !== $this->conflicts[$repositoryPath]) { return; } unset($this->conflicts[$repositoryPath]); $conflict->removeMapping($this); $this->refreshState(); }
/** * @expectedException \Puli\Manager\Api\NotLoadedException */ public function testRemoveMappingFailsIfPackageNotLoaded() { $mapping = new PathMapping('/path', 'resources'); $conflict = new PathConflict('/path/conflict'); $conflict->removeMapping($mapping); }