Skip to content

Commit

Permalink
Add support of composer 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChVuagniaux committed Nov 13, 2020
1 parent 886d787 commit 761450f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 37 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Classes/ComposerPackageDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://packagist.org/packages/1pilotapp/symfony-client"><img alt="Latest Version on Packagist" src="https://img.shields.io/packagist/v/1pilotapp/symfony-client.svg?style=flat-square"></a>
<a href="https://github.com/1PilotApp/symfony-client/blob/master/LICENSE.md"><img alt="Software License" src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square"></a>
<a href="https://travis-ci.org/1PilotApp/symfony-client"><img alt="Build Status" src="https://img.shields.io/travis/1PilotApp/symfony-client/master.svg?style=flat-square"></a>
<a href="https://github.com/1PilotApp/symfony-client/actions"><img alt="Build Status" src="https://img.shields.io/github/workflow/status/1PilotApp/symfony-client/tests?label=tests&style=flat-square"></a>
<a href="https://packagist.org/packages/1PilotApp/symfony-client"><img alt="Total Downloads" src="https://img.shields.io/packagist/dt/1pilotapp/symfony-client.svg?style=flat-square"></a>
</p>

Expand Down
11 changes: 11 additions & 0 deletions tests/Integration/ValidationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 761450f

Please sign in to comment.