Fix: typecast $value to array in multicheckbox and multiselect get_fo… #101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # WPUM E2E Tests | |
| # | |
| # Runs Playwright browser tests against a wp-env WordPress instance. | |
| # Builds vendor-dist (scoped dependencies) so the plugin loads correctly. | |
| # Tests run across multiple PHP versions via wp-env override. | |
| name: E2E Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master, develop] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| e2e: | |
| name: Playwright E2E (PHP ${{ matrix.php }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ['7.4', '8.1', '8.2', '8.3'] | |
| env: | |
| STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }} | |
| STRIPE_PUBLISHABLE_KEY: ${{ secrets.STRIPE_PUBLISHABLE_KEY }} | |
| WPUM_BILLING_OVERRIDE_KEY: ${{ secrets.WPUM_BILLING_OVERRIDE_KEY }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.2" | |
| coverage: none | |
| - name: Get Composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-progress --ignore-platform-reqs | |
| - name: Build scoped vendor (vendor-dist) | |
| run: | | |
| mkdir -p release/ci | |
| cp composer.json composer.lock scoper.inc.php release/ci/ | |
| php -r " | |
| \$j = json_decode(file_get_contents('release/ci/composer.json'), true); | |
| \$j['config']['autoloader-suffix'] = 'WPUMScoped'; | |
| file_put_contents('release/ci/composer.json', json_encode(\$j, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); | |
| " | |
| bash bin/prefix-dependencies.sh ci | |
| mv release/ci/vendor-dist ./vendor-dist | |
| rm -rf release/ci | |
| - name: Install npm dependencies | |
| run: npm ci --ignore-scripts --legacy-peer-deps | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Ensure mu-plugins directory exists | |
| run: mkdir -p tests/mu-plugins | |
| - name: Set wp-env PHP version | |
| run: echo '{"phpVersion":"${{ matrix.php }}"}' > .wp-env.override.json | |
| - name: Install Stripe CLI | |
| if: env.STRIPE_SECRET_KEY != '' | |
| run: | | |
| curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee /etc/apt/sources.list.d/stripe.list | |
| sudo apt update && sudo apt install stripe | |
| - name: Start wp-env | |
| run: npx @wordpress/env start | |
| - name: Start Stripe webhook listener | |
| if: env.STRIPE_SECRET_KEY != '' | |
| run: | | |
| stripe listen --forward-to http://localhost:8889/wp-json/wpum/v1/stripe --api-key $STRIPE_SECRET_KEY > /tmp/stripe-listen.log 2>&1 & | |
| sleep 5 | |
| WEBHOOK_SECRET=$(grep -o 'whsec_[a-zA-Z0-9]*' /tmp/stripe-listen.log | head -1) | |
| echo "STRIPE_WEBHOOK_SECRET=$WEBHOOK_SECRET" >> $GITHUB_ENV | |
| - name: Run E2E tests | |
| run: npx playwright test | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-report-php${{ matrix.php }} | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: test-results-php${{ matrix.php }} | |
| path: test-results/ | |
| retention-days: 7 |