Skip to content

Commit

Permalink
Merge pull request #38 from creative-commoners/pulls/1/backport-compo…
Browse files Browse the repository at this point in the history
…ser-2-support

Composer 2 (1.x backport)
  • Loading branch information
Garion Herman authored Oct 26, 2020
2 parents d6d83d1 + 20fd688 commit 913f2f6
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 10 deletions.
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,29 @@ cache:

matrix:
include:
- php: 5.6
- php: 7.2
- php: 7.1
env:
- COMPOSER_SELFUPDATE_ARG=--1
- COMPOSER_ARG=--prefer-lowest
- php: 7.3
env:
- COMPOSER_SELFUPDATE_ARG=--1
- php: 7.4
env:
- COMPOSER_SELFUPDATE_ARG=--preview
- php: nightly
env:
- COMPOSER_ARG=--ignore-platform-reqs
- COMPOSER_SELFUPDATE_ARG=--preview

fast_finish: true

before_script:
- phpenv rehash
- export PATH=~/.composer/vendor/bin:$PATH
- composer self-update $COMPOSER_SELFUPDATE_ARG
- composer validate
- composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o
- composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
- composer update --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile $COMPOSER_ARG

script:
- vendor/bin/phpunit
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
"lint": "phpcs src/ tests/",
"lint-clean": "phpcbf src/ tests/"
},
"minimum-stability": "dev",
"require": {
"composer/installers": "^1.4",
"composer-plugin-api": "^1.1"
"composer-plugin-api": "^1.1 || ^2",
"php": "^7.1 || ^8"
},
"require-dev": {
"composer/composer": "^1.5",
"phpunit/phpunit": "^5.7"
"composer/composer": "^1.5 || ^2@rc",
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3"
}
}
14 changes: 14 additions & 0 deletions src/VendorPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,18 @@ protected function installLibrary(IOInterface $IO, Library $library)
);
$task->process($IO, [$library]);
}

/**
* Required by the composer 2 plugin interface
*/
public function deactivate(Composer $composer, IOInterface $io)
{
}

/**
* Required by the composer 2 plugin interface
*/
public function uninstall(Composer $composer, IOInterface $io)
{
}
}
4 changes: 2 additions & 2 deletions tests/Methods/LibraryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LibraryTest extends TestCase
*/
public function testResourcesDir($expected, $projectPath)
{
$path = __DIR__ . '/fixtures/projects/' . $projectPath;
$path = __DIR__ . '/../fixtures/projects/' . $projectPath;
$lib = new Library($path, 'vendor/silverstripe/skynet');
$this->assertEquals($expected, $lib->getResourcesDir());
}
Expand All @@ -29,7 +29,7 @@ public function resourcesDirProvider()
public function testInvalidResourceDir()
{
$this->expectException(\LogicException::class);
$path = __DIR__ . '/fixtures/projects/ss44InvalidResourcesDir';
$path = __DIR__ . '/../fixtures/projects/ss44InvalidResourcesDir';
$lib = new Library($path, 'vendor/silverstripe/skynet');
$lib->getResourcesDir();
}
Expand Down
17 changes: 17 additions & 0 deletions tests/VendorPluginTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace SilverStripe\VendorPlugin\Tests;

use PHPUnit\Framework\TestCase;
use SilverStripe\VendorPlugin\VendorPlugin;

class VendorPluginTest extends TestCase
{
/**
* The simplest possible test, check that the plugin can be instantiated
*/
public function testInstantiation(): void
{
new VendorPlugin();
}
}

0 comments on commit 913f2f6

Please sign in to comment.