diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6cdb272..e312b12 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -10,16 +10,36 @@ permissions: contents: read jobs: - build: - + tests: runs-on: ubuntu-latest - + name: "Tests ${{ matrix.php-version }} deps ${{ matrix.dependency-versions }}" + strategy: + fail-fast: false + matrix: + # normal, highest, non-dev installs + php-version: [ '8.2', '8.1', '8.0' ] + dependency-versions: [ 'highest', 'lowest' ] + include: +# - php-version: '8.2' +# dependency-versions: 'lowest' + - php-version: '8.1' + dependency-versions: 'lowest' + - php-version: '8.0' + dependency-versions: 'lowest' + - php-version: '8.2' + dependency-versions: 'highest' + - php-version: '8.1' + dependency-versions: 'highest' + - php-version: '8.0' + dependency-versions: 'highest' steps: - uses: actions/checkout@v3 -# - name: Validate composer.json and composer.lock -# run: composer validate --strict - + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + coverage: "xdebug" + php-version: "${{ matrix.php-version }}" - name: Cache Composer packages id: composer-cache uses: actions/cache@v3 @@ -29,8 +49,11 @@ jobs: restore-keys: | ${{ runner.os }}-php- - - name: Install dependencies - run: composer install --prefer-dist --no-progress + - name: "Composer install" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "${{ matrix.dependency-versions }}" + composer-options: "--prefer-dist --no-cache --no-progress" # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" # Docs: https://getcomposer.org/doc/articles/scripts.md diff --git a/composer.json b/composer.json index b41e3c2..13fdb43 100755 --- a/composer.json +++ b/composer.json @@ -32,12 +32,12 @@ "ergebnis/composer-normalize": "^2.29", "friendsofphp/php-cs-fixer": "^3.13", "phpstan/phpstan": "^1.9", - "phpunit/php-code-coverage": "^9.2", - "phpunit/phpunit": "^9.5", + "phpunit/php-code-coverage": "^9", + "phpunit/phpunit": "^9.6", "symfony/expression-language": "^5.4 || ^6", "symfony/intl": "^5.4 || ^6", "symfony/var-dumper": "^5.4 || ^6", - "vimeo/psalm": "^5.2" + "vimeo/psalm": "^5.5" }, "suggest": { "ext-intl": "You need this PHP extension if you will be using `time_zone` alidator with option `intl_compatible`", diff --git a/tests/Unit/libraryTest.php b/tests/Unit/LibraryTest.php similarity index 96% rename from tests/Unit/libraryTest.php rename to tests/Unit/LibraryTest.php index 3f450ad..463f001 100644 --- a/tests/Unit/libraryTest.php +++ b/tests/Unit/LibraryTest.php @@ -81,13 +81,13 @@ public function testSerializeEmpty(): void $empty = $this->createEmptyDto(); $json = file_get_contents(__DIR__.'/json_empty.json'); - $this->testSerialize($empty, $json); + $this->serializeTest($empty, $json); } public function testSerializeValid(): void { $json = file_get_contents(__DIR__.'/json_valid.json'); - $this->testSerialize($this->createValidDto(), $json); + $this->serializeTest($this->createValidDto(), $json); } public function testIterableDto(): void @@ -113,7 +113,7 @@ public function testIterableDto(): void $simpleUser[$invalidProperty]; } - protected function testSerialize(AbstractDto $dtoTransfer, string $exceptedJson): void + private function serializeTest(AbstractDto $dtoTransfer, string $exceptedJson): void { $serializer = new SerializerFacadeDefault();