From 430e594654fae2fe81e591e21dbcf516a6ed8598 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Fri, 27 Oct 2023 14:55:51 +0200 Subject: [PATCH 1/3] Upgrade test matrix --- .github/workflows/ci.yml | 8 ++------ composer.json | 13 ++++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 848e3d5..0a6d72a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,13 +7,9 @@ on: # Triggers the workflow on push or pull request events but only for the master branch push: branches: - - master - - main - FRAMEWORK_6_0 pull_request: branches: - - master - - main - FRAMEWORK_6_0 @@ -27,8 +23,8 @@ jobs: strategy: matrix: operating-system: ['ubuntu-20.04'] - php-versions: ['7.4', '8.0', 'latest'] - phpunit-versions: ['latest', '9.5'] + php-versions: ['7.4', '8.0', '8.1', '8.2', 'latest'] + phpunit-versions: ['latest', '10.5'] steps: - name: Setup github ssh key run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts diff --git a/composer.json b/composer.json index c4bb637..d50ee77 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,6 @@ } ], "time": "2021-11-03", - "repositories": [ - { - "type": "composer", - "url": "https://horde-satis.maintaina.com/" - } - ], "require": { "php": "^7.4 || ^8", "horde/support": "^3 || dev-FRAMEWORK_6_0", @@ -58,5 +52,10 @@ "psr-4": { "Horde\\Test\\Test\\": "test/" } + }, + "config": { + "allow-plugins": { + "horde/horde-installer-plugin": true + } } -} \ No newline at end of file +} From 8ebe9d428dd3b31fbd7b77bc37959eb4111d6006 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Fri, 27 Oct 2023 15:33:45 +0200 Subject: [PATCH 2/3] PHPUnit 10 and PHP < 8.1 don't play nicely - Avoid cross dependencies of PHP and PHPUnit Explicitly not fail fast --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a6d72a..32d6095 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,10 @@ jobs: run: runs-on: ${{ matrix.operating-system }} strategy: + fail-fast: false matrix: - operating-system: ['ubuntu-20.04'] + operating-system: ['ubuntu-22.04'] php-versions: ['7.4', '8.0', '8.1', '8.2', 'latest'] - phpunit-versions: ['latest', '10.5'] steps: - name: Setup github ssh key run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts @@ -37,7 +37,7 @@ jobs: extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter ini-values: post_max_size=512M, max_execution_time=360 coverage: xdebug - tools: php-cs-fixer, phpunit:${{ matrix.phpunit-versions }}, composer:v2, phpstan + tools: php-cs-fixer, phpunit, composer:v2, phpstan - name: Setup Github Token as composer credential run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - name: Install horde/test dependency and other dependencies From 0aa249df9731e8367eea8c494c64daae782bf1d3 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Fri, 27 Oct 2023 16:07:07 +0200 Subject: [PATCH 3/3] Make phpstan happy - we won't support intersection types here soon q --- src/TestCase.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TestCase.php b/src/TestCase.php index 87ab351..eb98135 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -17,6 +17,7 @@ use Horde_Support_Backtrace; use ReflectionClass; +use ReflectionNamedType; /** * Basic Horde test case helper. @@ -127,7 +128,10 @@ public function getMockDependencies(string $class, array $overrides = []) } else { if (is_null($type)) { throw new Exception("dependency $name has no type defined and is not in overrides array"); + } elseif (!($type instanceof ReflectionNamedType)) { + throw new Exception("dependency $name is a union or intersection type"); } + // TODO: How would we handle a union or intersection dependency? $typeName = $type->getName(); switch ($typeName) { case 'int':