name: phpunit

on: pull_request

jobs:
  test:

    runs-on: ubuntu-latest

    steps:
    - name: Set up PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.2'
    - uses: actions/checkout@v3

    - name: Install NPM Scripts
      run: npm install
    - name: Install Composer Package
      run: composer install
    - name: Install @wordpress/env
      run: npm install -g @wordpress/env
    - name: Run @wordpress/env
      run: npx wp-env start

    # PHPUnitテスト実行
    - name: Run PHPUnit test.
      run: |
        npm run phpunit