Skip to content

Commit

Permalink
Fix the build (#90)
Browse files Browse the repository at this point in the history
Fix the code quality and fix the PHPUnit issue with PHPUnit 10.5.
  • Loading branch information
Elendev authored Aug 15, 2024
1 parent 74cd140 commit 7c157c7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testing-and-cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 20 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
<exclude>tests/ZipArchiverTest/TypicalArchive</exclude>
<exclude>tests/ZipArchiverTest/ComposerJsonArchive</exclude>
</testsuite>
</testsuites>

<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
4 changes: 2 additions & 2 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ZipArchiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/ZipArchiverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 7c157c7

Please sign in to comment.