Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade test matrix #4

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -25,10 +21,10 @@ jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-20.04']
php-versions: ['7.4', '8.0', 'latest']
phpunit-versions: ['latest', '9.5']
operating-system: ['ubuntu-22.04']
php-versions: ['7.4', '8.0', '8.1', '8.2', 'latest']
steps:
- name: Setup github ssh key
run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts
Expand All @@ -41,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
Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -58,5 +52,10 @@
"psr-4": {
"Horde\\Test\\Test\\": "test/"
}
},
"config": {
"allow-plugins": {
"horde/horde-installer-plugin": true
}
}
}
}
4 changes: 4 additions & 0 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use Horde_Support_Backtrace;
use ReflectionClass;
use ReflectionNamedType;

/**
* Basic Horde test case helper.
Expand Down Expand Up @@ -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':
Expand Down