+
Skip to content

refactor(php): convert if/else to ternary #814

refactor(php): convert if/else to ternary

refactor(php): convert if/else to ternary #814

Workflow file for this run

##
# OpenEMR has two different kinds of tests:
# - "Isolated tests": Tests that run without secondary services, a data layer or significant initialization requirements
# - "Tests": Tests that require a database and initialization before they can run or pass.
# This workflow runs the kind that does not require initialization.
name: Isolated Tests
on:
push:
branches:
- master
- rel-*
pull_request:
branches:
- master
- rel-*
jobs:
isolated-tests:
runs-on: ubuntu-24.04
strategy:
matrix:
php-version:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
name: PHP ${{ matrix.php-version }} - Isolated Tests
steps:
- uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: ${{ matrix.php-version }}
- name: Get composer cache directory
id: composer-cache
run: |
{
printf 'dir='
composer config cache-files-dir
} >> $GITHUB_OUTPUT
- name: Composer Cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.configurations.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.configurations.php }}-
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run isolated tests with coverage
run: |
vendor/bin/phpunit -c phpunit-isolated.xml \
--coverage-clover=clover.xml \
--coverage-filter=apis \
--coverage-filter=gacl \
--coverage-filter=interface \
--coverage-filter=library \
--coverage-filter=modules \
--coverage-filter=oauth2 \
--coverage-filter=portal \
--coverage-filter=sites \
--coverage-filter=src \
--coverage-filter=tests \
--coverage-html=htmlcov \
--log-junit=junit.xml \
--testdox
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Check if coverage files exist
if: ${{ (success() || failure()) }}
id: check-files
run: |
echo "clover_exists=$(test -f clover.xml && echo true || echo false)" >> $GITHUB_OUTPUT
echo "htmlcov_exists=$(test -d ./htmlcov && echo true || echo false)" >> $GITHUB_OUTPUT
- name: Upload coverage reports
if: ${{ steps.check-files.outputs.clover_exists == 'true' && steps.check-files.outputs.html_exists == 'true' && (success() || failure()) }}
uses: actions/upload-artifact@v4
with:
name: coverage-isolated-tests-php-${{ matrix.php-version }}
path: |
clover.xml
htmlcov/
- name: Upload coverage reports to Codecov
if: ${{ steps.check-files.outputs.clover_exists == 'true' && (success() || failure()) }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: clover.xml
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载