public function getCoreBundleVersion() { $installedFile = $this->kernelRootDir . '/../vendor/composer/installed.json'; $repo = new InstalledFilesystemRepository(new JsonFile($installedFile)); $corePackage = $repo->findPackage('claroline/core-bundle', '*'); return $corePackage->getPrettyVersion(); }
public function getCurrentDistributionCommit() { $repo = new InstalledFilesystemRepository(new JsonFile($this->installedRepoFile)); $distrib = $repo->findPackage('claroline/distribution', '*'); return $distrib->getSourceReference(); }
public function testExecuteCallsInstallersAndUpdatePreviousRepo() { vfsStream::setup('root'); $previous = vfsStream::url('root/previous-installed.json'); file_put_contents($previous, file_get_contents($this->repo('repo-1'))); $this->executor->setRepositoryFiles($previous, '/does/not/exist'); $this->kernel->expects($this->once())->method('getBundles')->willReturn([$this->mockBundle('Foo'), $this->mockBundle('Quz', true), $this->mockBundle('Bar', true)]); $this->baseInstaller->expects($this->once())->method('install')->will($this->throwException(new \Exception('from test'))); $installOp1 = new Operation(Operation::INSTALL, $this->package('quz', '3.4.1.2', 'claroline-plugin'), 'Quz'); $updateOp = new Operation(Operation::UPDATE, $this->package('bar', '2.0.0.0', 'claroline-plugin'), 'Bar'); $updateOp->setFromVersion('2.0.0.0'); $updateOp->setToVersion('3.0.0.0'); $installOp2 = new Operation(Operation::INSTALL, $this->package('foo', '5.2.3.1', 'claroline-core'), 'Foo'); try { $this->executor->execute([$installOp1, $updateOp, $installOp2]); $this->fail('An exception should have been thrown'); } catch (\Exception $ex) { $this->assertTrue(file_exists($previous)); $repo = new InstalledFilesystemRepository(new JsonFile($previous)); $this->assertNotNull($repo->findPackage('quz', '3.4.1.2')); $this->assertNotNull($repo->findPackage('bar', '2.0.0.0')); } }