diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..0dbfc87 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,47 @@ +name: CI + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: + - "7.4" + - "8.1" + - "8.2" + - "8.3" + - "8.4" + dependencies: + - "lowest" + - "highest" + + name: Tests with PHP ${{ matrix.php-version }} and ${{ matrix.dependencies }} dependencies + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate composer + run: composer validate + + - name: Composer install + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "${{ matrix.composer-options }}" + + - name: Run unit tests suite + run: vendor/bin/phpunit diff --git a/composer.json b/composer.json index a7d3b1d..c6d41cf 100644 --- a/composer.json +++ b/composer.json @@ -2,22 +2,25 @@ "name": "magento/composer", "description": "Magento composer library helps to instantiate Composer application and run composer commands.", "type": "library", - "version": "1.7.0", + "version": "1.10.1", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "php": "~7.3.0||~7.4.0", - "composer/composer": "^1.9 || ^2.0", - "symfony/console": "~4.4.0" + "php": "~7.4.0||~8.1.0||~8.2.0||~8.3.0||~8.4.0", + "composer/composer": "^2.1.13", + "symfony/console": "~4.4.0||~5.4.0||~6.4.0" }, "require-dev": { - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9.5.10 || ^10" }, "autoload": { "psr-4": { "Magento\\Composer\\": "src" } + }, + "archive": { + "exclude": [".github", ".gitignore"] } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a6c40a9..dc7c76e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,27 +1,23 @@ - + bootstrap="vendor/autoload.php"> - + - ./tests/ - - - + + ./ - - ./tests - - - + + + ./tests + + diff --git a/src/MagentoComposerApplication.php b/src/MagentoComposerApplication.php index ef9ce98..4e6defc 100644 --- a/src/MagentoComposerApplication.php +++ b/src/MagentoComposerApplication.php @@ -65,9 +65,9 @@ class MagentoComposerApplication public function __construct( $pathToComposerHome, $pathToComposerJson, - Application $consoleApplication = null, - ConsoleArrayInputFactory $consoleArrayInputFactory = null, - BufferedOutput $consoleOutput = null + ?Application $consoleApplication = null, + ?ConsoleArrayInputFactory $consoleArrayInputFactory = null, + ?BufferedOutput $consoleOutput = null ) { $this->consoleApplication = $consoleApplication ? $consoleApplication : new Application(); $this->consoleArrayInputFactory = $consoleArrayInputFactory ? $consoleArrayInputFactory diff --git a/tests/Composer/InfoCommandTest.php b/tests/Composer/InfoCommandTest.php index d5e664c..3cf7999 100644 --- a/tests/Composer/InfoCommandTest.php +++ b/tests/Composer/InfoCommandTest.php @@ -74,7 +74,7 @@ public function testRunInstalled() * * @return array */ - public function getCommandOutputDataProvider() + public static function getCommandOutputDataProvider() { return [ 'Package not installed' => [ diff --git a/tests/Composer/MagentoComposerApplicationTest.php b/tests/Composer/MagentoComposerApplicationTest.php index 113a1ff..742856c 100644 --- a/tests/Composer/MagentoComposerApplicationTest.php +++ b/tests/Composer/MagentoComposerApplicationTest.php @@ -34,7 +34,8 @@ class MagentoComposerApplicationTest extends \PHPUnit\Framework\TestCase protected function setUp(): void { - $this->composerApplication = $this->createMock(\Composer\Console\Application::class); + $this->composerApplication = $this->getMockBuilder('Composer\Console\Application') + ->getMock(); $this->inputFactory = $this->createMock(\Magento\Composer\ConsoleArrayInputFactory::class); $this->consoleOutput = $this->createMock(\Symfony\Component\Console\Output\BufferedOutput::class);