Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • spip-league/composer-installer
1 résultat
Afficher les modifications
...@@ -18,7 +18,7 @@ class SpecificationStub implements SpecificationInterface ...@@ -18,7 +18,7 @@ class SpecificationStub implements SpecificationInterface
string $prefix = '', string $prefix = '',
string $vendorName = '', string $vendorName = '',
string $constraint = '', string $constraint = '',
string $path = 'path' string $path = 'path',
) { ) {
$this->prefix = $prefix; $this->prefix = $prefix;
$this->vendorName = $vendorName; $this->vendorName = $vendorName;
......
...@@ -25,9 +25,7 @@ class SpipInstallerTest extends TestCase ...@@ -25,9 +25,7 @@ class SpipInstallerTest extends TestCase
$package->setExtra([ $package->setExtra([
'spip' => [ 'spip' => [
'template' => 'spip/default-template', 'template' => 'spip/default-template',
'extensions' => [ 'extensions' => ['spip/mandatory'],
'spip/mandatory',
],
], ],
]); ]);
$composer->setPackage($package); $composer->setPackage($package);
......
...@@ -43,11 +43,12 @@ class AnalyzerTest extends TestCase ...@@ -43,11 +43,12 @@ class AnalyzerTest extends TestCase
$this->composer = new Composer(); $this->composer = new Composer();
$this->composer->setPackage($rootPackage); $this->composer->setPackage($rootPackage);
$this->composer->setConfig(new Config()); $this->composer->setConfig(new Config());
$this->composer->getConfig()->setConfigSource( $this->composer->getConfig()
new JsonConfigSource(new JsonFile($this->tmpDir . '/AnalyzerTest.json')) ->setConfigSource(new JsonConfigSource(new JsonFile($this->tmpDir . '/AnalyzerTest.json')));
); $this->composer->getConfig()
$this->composer->getConfig()->getConfigSource()->addConfigSetting('test', 'test'); ->getConfigSource()
$this->composer->setLoop(new Loop(new HttpDownloader(new NullIO, $this->composer->getConfig()))); ->addConfigSetting('test', 'test');
$this->composer->setLoop(new Loop(new HttpDownloader(new NullIO(), $this->composer->getConfig())));
} }
protected function tearDown(): void protected function tearDown(): void
......
...@@ -32,7 +32,10 @@ class AddSpecificationTest extends TestCase ...@@ -32,7 +32,10 @@ class AddSpecificationTest extends TestCase
$this->filesystem->emptyDirectory($this->tmpDir); $this->filesystem->emptyDirectory($this->tmpDir);
$this->collection = new CollectionMock($this->tmpDir . '/AddSpecificationTest.json'); $this->collection = new CollectionMock($this->tmpDir . '/AddSpecificationTest.json');
$this->collection[] = new SpecificationMock('exist'); $this->collection[] = new SpecificationMock('exist');
\file_put_contents($this->tmpDir . '/AddSpecificationTest.json', '{"exist":{"path":"path","source":"https://git-server/vendor/exist.git","branch":"1.0","tag":"v1.0.0"}}'); \file_put_contents(
$this->tmpDir . '/AddSpecificationTest.json',
'{"exist":{"path":"path","source":"https://git-server/vendor/exist.git","branch":"1.0","tag":"v1.0.0"}}',
);
} }
protected function tearDown(): void protected function tearDown(): void
...@@ -52,7 +55,6 @@ class AddSpecificationTest extends TestCase ...@@ -52,7 +55,6 @@ class AddSpecificationTest extends TestCase
'expected' => \null, 'expected' => \null,
'prefix' => 'exist', 'prefix' => 'exist',
], ],
]; ];
} }
...@@ -66,7 +68,7 @@ class AddSpecificationTest extends TestCase ...@@ -66,7 +68,7 @@ class AddSpecificationTest extends TestCase
$actual = $operation->mark($this->collection, $this->composer); $actual = $operation->mark($this->collection, $this->composer);
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -32,15 +32,18 @@ class AddToRequireTest extends TestCase ...@@ -32,15 +32,18 @@ class AddToRequireTest extends TestCase
$this->filesystem->emptyDirectory($this->tmpDir); $this->filesystem->emptyDirectory($this->tmpDir);
$rootPackage = new RootPackage('test/test', '1', '1'); $rootPackage = new RootPackage('test/test', '1', '1');
$rootPackage->setRequires(['vendor/exist' => new Link('test/test', 'vendor/exist', new Constraint('>=', '1.0'))]); $rootPackage->setRequires(
['vendor/exist' => new Link('test/test', 'vendor/exist', new Constraint('>=', '1.0'))],
);
$this->composer = new Composer(); $this->composer = new Composer();
$this->composer->setConfig(new Config()); $this->composer->setConfig(new Config());
$this->composer->getConfig()->setConfigSource( $this->composer->getConfig()
new JsonConfigSource(new JsonFile($this->tmpDir . '/AddToRequireTest.json')) ->setConfigSource(new JsonConfigSource(new JsonFile($this->tmpDir . '/AddToRequireTest.json')));
);
$this->composer->setPackage($rootPackage); $this->composer->setPackage($rootPackage);
$this->composer->getConfig()->getConfigSource()->addLink('require', 'vendor/exist', '^1.0'); $this->composer->getConfig()
->getConfigSource()
->addLink('require', 'vendor/exist', '^1.0');
} }
protected function tearDown(): void protected function tearDown(): void
......
...@@ -32,14 +32,16 @@ class AddToSpipExtraExtensionsTest extends TestCase ...@@ -32,14 +32,16 @@ class AddToSpipExtraExtensionsTest extends TestCase
$this->composer = new Composer(); $this->composer = new Composer();
$this->composer->setConfig(new Config()); $this->composer->setConfig(new Config());
$this->composer->getConfig()->setConfigSource( $this->composer->getConfig()
new JsonConfigSource(new JsonFile($this->tmpDir . '/AddToSpipExtraExtensionsTest.json')) ->setConfigSource(new JsonConfigSource(new JsonFile($this->tmpDir . '/AddToSpipExtraExtensionsTest.json')));
);
$rootPackage = new RootPackage('test/test', '1', '1'); $rootPackage = new RootPackage('test/test', '1', '1');
$this->composer->setPackage($rootPackage); $this->composer->setPackage($rootPackage);
$this->composer->getConfig()->getConfigSource()->addProperty('extra.spip.extensions', ['vendor/exist']); $this->composer->getConfig()
$this->composer->getPackage()->setExtra(['spip' => ['extensions' => ['vendor/exist']]]); ->getConfigSource()
->addProperty('extra.spip.extensions', ['vendor/exist']);
$this->composer->getPackage()
->setExtra(['spip' => ['extensions' => ['vendor/exist']]]);
} }
protected function tearDown(): void protected function tearDown(): void
...@@ -72,7 +74,7 @@ class AddToSpipExtraExtensionsTest extends TestCase ...@@ -72,7 +74,7 @@ class AddToSpipExtraExtensionsTest extends TestCase
$actual = $operation->mark(new CollectionDummy(), $this->composer); $actual = $operation->mark(new CollectionDummy(), $this->composer);
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -50,7 +50,6 @@ class RemoveDirectoryTest extends TestCase ...@@ -50,7 +50,6 @@ class RemoveDirectoryTest extends TestCase
'expected' => OperationInterface::class, 'expected' => OperationInterface::class,
'directory' => 'empty', 'directory' => 'empty',
], ],
]; ];
} }
...@@ -64,7 +63,7 @@ class RemoveDirectoryTest extends TestCase ...@@ -64,7 +63,7 @@ class RemoveDirectoryTest extends TestCase
$actual = $operation->mark(new CollectionDummy(), new Composer()); $actual = $operation->mark(new CollectionDummy(), new Composer());
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -33,15 +33,18 @@ class RemoveFromRequireTest extends TestCase ...@@ -33,15 +33,18 @@ class RemoveFromRequireTest extends TestCase
$this->filesystem->emptyDirectory($this->tmpDir); $this->filesystem->emptyDirectory($this->tmpDir);
$rootPackage = new RootPackage('test/test', '1', '1'); $rootPackage = new RootPackage('test/test', '1', '1');
$rootPackage->setRequires(['vendor/exist' => new Link('test/test', 'vendor/exist', new Constraint('>=', '1.0'))]); $rootPackage->setRequires(
['vendor/exist' => new Link('test/test', 'vendor/exist', new Constraint('>=', '1.0'))],
);
$this->composer = new Composer(); $this->composer = new Composer();
$this->composer->setConfig(new Config()); $this->composer->setConfig(new Config());
$this->composer->getConfig()->setConfigSource( $this->composer->getConfig()
new JsonConfigSource(new JsonFile($this->tmpDir . '/RemoveFromRequireTest.json')) ->setConfigSource(new JsonConfigSource(new JsonFile($this->tmpDir . '/RemoveFromRequireTest.json')));
);
$this->composer->setPackage($rootPackage); $this->composer->setPackage($rootPackage);
$this->composer->getConfig()->getConfigSource()->addLink('require', 'vendor/exist', '^1.0'); $this->composer->getConfig()
->getConfigSource()
->addLink('require', 'vendor/exist', '^1.0');
} }
protected function tearDown(): void protected function tearDown(): void
...@@ -75,7 +78,7 @@ class RemoveFromRequireTest extends TestCase ...@@ -75,7 +78,7 @@ class RemoveFromRequireTest extends TestCase
$actual = $operation->mark(new CollectionDummy(), $this->composer); $actual = $operation->mark(new CollectionDummy(), $this->composer);
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -32,14 +32,18 @@ class RemoveFromSpipExtraExtensionsTest extends TestCase ...@@ -32,14 +32,18 @@ class RemoveFromSpipExtraExtensionsTest extends TestCase
$this->composer = new Composer(); $this->composer = new Composer();
$this->composer->setConfig(new Config()); $this->composer->setConfig(new Config());
$this->composer->getConfig()->setConfigSource( $this->composer->getConfig()
new JsonConfigSource(new JsonFile($this->tmpDir . '/RemoveFromSpipExtraExtensionsTest.json')) ->setConfigSource(
); new JsonConfigSource(new JsonFile($this->tmpDir . '/RemoveFromSpipExtraExtensionsTest.json')),
);
$rootPackage = new RootPackage('test/test', '1', '1'); $rootPackage = new RootPackage('test/test', '1', '1');
$this->composer->setPackage($rootPackage); $this->composer->setPackage($rootPackage);
$this->composer->getConfig()->getConfigSource()->addProperty('extra.spip.extensions', ['vendor/exist']); $this->composer->getConfig()
$this->composer->getPackage()->setExtra(['spip' => ['extensions' => ['vendor/exist']]]); ->getConfigSource()
->addProperty('extra.spip.extensions', ['vendor/exist']);
$this->composer->getPackage()
->setExtra(['spip' => ['extensions' => ['vendor/exist']]]);
} }
protected function tearDown(): void protected function tearDown(): void
...@@ -72,7 +76,7 @@ class RemoveFromSpipExtraExtensionsTest extends TestCase ...@@ -72,7 +76,7 @@ class RemoveFromSpipExtraExtensionsTest extends TestCase
$actual = $operation->mark(new CollectionDummy(), $this->composer); $actual = $operation->mark(new CollectionDummy(), $this->composer);
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -31,7 +31,10 @@ class RemoveSpecificationTest extends TestCase ...@@ -31,7 +31,10 @@ class RemoveSpecificationTest extends TestCase
$this->filesystem->emptyDirectory($this->tmpDir); $this->filesystem->emptyDirectory($this->tmpDir);
$this->collection = new CollectionMock($this->tmpDir . '/RemoveSpecificationTest.json'); $this->collection = new CollectionMock($this->tmpDir . '/RemoveSpecificationTest.json');
$this->collection[] = new SpecificationMock('exist'); $this->collection[] = new SpecificationMock('exist');
\file_put_contents($this->tmpDir . '/RemoveSpecificationTest.json', '{"exist":{"path":"path","source":"source","branch":"1.0"}}'); \file_put_contents(
$this->tmpDir . '/RemoveSpecificationTest.json',
'{"exist":{"path":"path","source":"source","branch":"1.0"}}',
);
} }
protected function tearDown(): void protected function tearDown(): void
...@@ -51,7 +54,6 @@ class RemoveSpecificationTest extends TestCase ...@@ -51,7 +54,6 @@ class RemoveSpecificationTest extends TestCase
'expected' => OperationInterface::class, 'expected' => OperationInterface::class,
'prefix' => 'exist', 'prefix' => 'exist',
], ],
]; ];
} }
...@@ -65,7 +67,7 @@ class RemoveSpecificationTest extends TestCase ...@@ -65,7 +67,7 @@ class RemoveSpecificationTest extends TestCase
$actual = $operation->mark($this->collection, $this->composer); $actual = $operation->mark($this->collection, $this->composer);
// Then // Then
if (\is_null($expected)) { if ($expected === null) {
$this->assertNull($actual); $this->assertNull($actual);
} else { } else {
$this->assertInstanceOf($expected, $actual); $this->assertInstanceOf($expected, $actual);
......
...@@ -64,7 +64,7 @@ class SwitcherTest extends TestCase ...@@ -64,7 +64,7 @@ class SwitcherTest extends TestCase
// When // When
$switcher->to($operation); $switcher->to($operation);
foreach($switcher->flush(fn() => $this->composer) as $message) { foreach ($switcher->flush(fn() => $this->composer) as $message) {
$actual[] = $message; $actual[] = $message;
} }
......