abe738e900
- composer.json / phpunit.xml / tests/bootstrap.php(比照 HP AddOn, 直接 require 核心 plugin 的 unit bootstrap) - tests/unit/WooCommerceIntegrationTest.php(自 A 移植,10 tests) - .gitea/workflows/test.yml:lint + unit(unit job 會一併 checkout 核心 plugin, 因為測試 bootstrap 依賴它) 10 tests / 33 assertions GREEN Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbG1keQQ7XBa7qMQY16KCY
47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master, develop ]
|
|
pull_request:
|
|
branches: [ main, master, develop ]
|
|
|
|
jobs:
|
|
lint:
|
|
name: PHP Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Check PHP syntax
|
|
run: |
|
|
find . -name "*.php" ! -path "./vendor/*" ! -path "./tests/*" -print0 | xargs -0 -n1 php -l
|
|
echo "PHP syntax OK"
|
|
|
|
unit:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
# The suite boots off the core plugin's test bootstrap, so the core must be
|
|
# checked out next to this AddOn under wp-content/plugins/.
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
path: 2meet-data-optimizer-woocommerce-addon
|
|
|
|
- name: Checkout core plugin
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: wpdev/2meet-data-optimizer
|
|
path: 2meet-data-optimizer
|
|
|
|
- name: Install dependencies
|
|
working-directory: 2meet-data-optimizer-woocommerce-addon
|
|
run: composer install --no-interaction --prefer-dist
|
|
|
|
- name: Install core dev dependencies (test bootstrap needs them)
|
|
working-directory: 2meet-data-optimizer
|
|
run: composer install --no-interaction --prefer-dist
|
|
|
|
- name: Run unit tests
|
|
working-directory: 2meet-data-optimizer-woocommerce-addon
|
|
run: php vendor/bin/phpunit --configuration phpunit.xml --testdox
|