The method {@link load()} needs to be called before calling this method,
otherwise an exception is thrown.
public isConflicting ( ) : boolean | ||
return | boolean | Returns `true` if the state is {@link PathMappingState::CONFLICT}. |
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()); }
public function testRemovesRootPathMappingRestoresConflictsIfSavingFails() { $this->initDefaultManager(); $this->rootPackageFile->addPathMapping($mapping1 = new PathMapping('/path', 'resources')); $this->packageFile1->addPathMapping($mapping2 = new PathMapping('/path', 'resources')); $this->repo->expects($this->at(0))->method('add')->with('/path', new DirectoryResource($this->packageDir1 . '/resources')); $this->repo->expects($this->at(1))->method('remove')->with('/path'); $this->packageFileStorage->expects($this->once())->method('saveRootPackageFile')->willThrowException(new TestException('Cannot save')); try { $this->manager->removeRootPathMapping('/path'); $this->fail('Expected a TestException'); } catch (TestException $e) { } $this->assertTrue($mapping1->isConflicting()); $this->assertTrue($mapping2->isConflicting()); $this->assertCount(1, $this->manager->getPathConflicts()); }