diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..1ede569 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: tests + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * *' + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - php: 7.0 + symfony: 3.4 + + - php: 7.1 + symfony: 4.1 + + - php: 7.2 + symfony: 3.4 + - php: 7.2 + symfony: 4.1 + - php: 7.2 + symfony: 4.2 + + - php: 7.3 + symfony: 4.3 + - php: 7.3 + symfony: 4.4 + + name: PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: | + composer require "symfony/framework-bundle:${{ matrix.symfony }}" --no-interaction --no-update + composer update --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: vendor/bin/phpunit --verbose diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0516259..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: php - -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 7.0 - env: SYMFONY="3.4" - - php: 7.1 - env: SYMFONY="4.1" - - - php: 7.2 - env: SYMFONY="3.4" - - php: 7.2 - env: SYMFONY="4.1" - - php: 7.2 - env: SYMFONY="4.2" - - - php: 7.3 - env: SYMFONY="4.3.x-dev" STABILITY="dev" - - allow_failures: - - php: 7.3 - env: SYMFONY="4.3.x-dev" STABILITY="dev" - -before_script: - - travis_retry composer self-update - - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; - - travis_retry composer require "symfony/framework-bundle:${SYMFONY}" --no-interaction --prefer-dist - -script: - - composer test diff --git a/CHANGELOG.md b/CHANGELOG.md index 093b325..eb775de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `symfony-client` will be documented in this file. +## 1.0.2 - 2020-11-13 + +- Add support of composer 2 + ## 1.0.1 - 2019-11-12 - Add Central Error Logs diff --git a/Classes/ComposerPackageDetector.php b/Classes/ComposerPackageDetector.php index 048e514..a6905a0 100644 --- a/Classes/ComposerPackageDetector.php +++ b/Classes/ComposerPackageDetector.php @@ -24,6 +24,10 @@ public function getPackages(): array $installedJsonFile = $this->projectRoot . '/vendor/composer/installed.json'; $installedPackages = json_decode(file_get_contents($installedJsonFile)); + if (!empty($installedPackages->packages)) { + return $installedPackages->packages; // composer v2 + } + return $installedPackages; } diff --git a/README.md b/README.md index 32e6660..a0aac2a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

Latest Version on Packagist Software License -Build Status +Build Status Total Downloads

diff --git a/tests/Integration/ValidationsTest.php b/tests/Integration/ValidationsTest.php index 3e80966..a99943b 100644 --- a/tests/Integration/ValidationsTest.php +++ b/tests/Integration/ValidationsTest.php @@ -47,6 +47,17 @@ public function extra_parameters() $this->assertEquals($this->container->getParameter('kernel.environment'), $extra['app.env']); } + /** @test */ + public function packages() + { + $plugins = $this->getDecodedData('plugins'); + + $pluginsCode = array_column($plugins, 'code'); + + $this->assertContains('composer/semver', $pluginsCode); + $this->assertContains('guzzlehttp/guzzle', $pluginsCode); + } + /** * @param string|null $section *