From 7c157c7ec28def465128f1bb491d01f8470dfad8 Mon Sep 17 00:00:00 2001 From: Jonas Renaudot Date: Thu, 15 Aug 2024 18:01:59 +0200 Subject: [PATCH] Fix the build (#90) Fix the code quality and fix the PHPUnit issue with PHPUnit 10.5. --- .github/workflows/testing-and-cs.yaml | 4 ++-- phpunit.xml | 20 ++++++++++++++++++++ src/Configuration.php | 4 ++-- src/ZipArchiver.php | 2 +- tests/ZipArchiverTest.php | 4 ++-- 5 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 phpunit.xml diff --git a/.github/workflows/testing-and-cs.yaml b/.github/workflows/testing-and-cs.yaml index ab25fcd..ce38724 100644 --- a/.github/workflows/testing-and-cs.yaml +++ b/.github/workflows/testing-and-cs.yaml @@ -36,7 +36,7 @@ jobs: tools: composer:${{ matrix.composer }} - run: composer require "symfony/finder:${{ matrix.symfony }}" "symfony/filesystem:${{ matrix.symfony }}" - run: composer install - - run: vendor/bin/phpunit tests + - run: vendor/bin/phpunit PHPUnit-Symfony56: name: PHPUnit testing runs-on: ubuntu-latest @@ -56,7 +56,7 @@ jobs: tools: composer:${{ matrix.composer }} - run: composer require "symfony/finder:${{ matrix.symfony }}" "symfony/filesystem:${{ matrix.symfony }}" - run: composer install - - run: vendor/bin/phpunit tests + - run: vendor/bin/phpunit BuildDone: name: PHP full build diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..442b87b --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,20 @@ + + + + + tests + tests/ZipArchiverTest/TypicalArchive + tests/ZipArchiverTest/ComposerJsonArchive + + + + + + src + + + diff --git a/src/Configuration.php b/src/Configuration.php index 130af04..f2571e7 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -303,13 +303,13 @@ private function parseNexusExtra(InputInterface $input, Composer $composer) } } else { // configurations in composer.json support upload to multi repository - foreach ($extras[$extrasConfigurationKey] as $key=> $nexusPushConfigItem) { + foreach ($extras[$extrasConfigurationKey] as $key => $nexusPushConfigItem) { if (empty($nexusPushConfigItem[self::PUSH_CFG_NAME])) { $fmt = 'The push configuration array in composer.json with index {%s} need provide value for key "%s"'; $exceptionMsg = sprintf($fmt, $key, self::PUSH_CFG_NAME); throw new InvalidConfigException($exceptionMsg); } - if ($nexusPushConfigItem[self::PUSH_CFG_NAME] ==$repository) { + if ($nexusPushConfigItem[self::PUSH_CFG_NAME] == $repository) { return $nexusPushConfigItem; } } diff --git a/src/ZipArchiver.php b/src/ZipArchiver.php index b2e5f69..37e6b3d 100644 --- a/src/ZipArchiver.php +++ b/src/ZipArchiver.php @@ -128,7 +128,7 @@ private static function updateVersion($zipFile, $subDirectory, $version, $io) $archive->deleteName($filePath); - $archive->addFromString($filePath, json_encode($content, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); + $archive->addFromString($filePath, json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); $archive->close(); } diff --git a/tests/ZipArchiverTest.php b/tests/ZipArchiverTest.php index 2b93e3f..d695bd9 100644 --- a/tests/ZipArchiverTest.php +++ b/tests/ZipArchiverTest.php @@ -39,7 +39,7 @@ public function testArchiveDirectory(string $directory, array $expectedResult, s $this->assertArchiveContainsFiles($this->generationPath, $expectedResult); } - public function zipArchiverProvider() { + public static function zipArchiverProvider() { return [ [ __DIR__ . '/ZipArchiverTest/TypicalArchive', @@ -103,7 +103,7 @@ public function testComposerArchiveDirectory(string $directory, array $expectedR $this->assertComposerJsonVersion($this->generationPath, $subdirectory, $version); } - public function composerArchiverProvider() { + public static function composerArchiverProvider() { return [ [ __DIR__ . '/ZipArchiverTest/ComposerJsonArchive',