From 0647429deb38c847d26bec03de9ae7a83a5d0ff1 Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Thu, 14 Sep 2023 16:18:29 +0300 Subject: [PATCH] chore: trigger units test on pr --- .github/workflows/test-php.yml | 37 ++++++++++++++++++++++++++++++++ inc/plugins/class-stripe-api.php | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 05a8b9eb6..c8aceb11d 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -100,3 +100,40 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: PHPStan Static Analysis run: composer phpstan + + unit: + name: UnitTests + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + # setup the composer cache (vendor) with github actions cache and the cache dir defined in the previous step + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + # run composer install + - name: Install composer + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Create License File + run: | + printf "{\"key\":\"${{ secrets.OTTER_PRO_LICENSE }}\"}" > license.json + + - name: Setup WP Env + run: | + npm run test:unit:php:setup + + - name: Run PHP Unit Tests + run: | + npm run test:unit:php:base diff --git a/inc/plugins/class-stripe-api.php b/inc/plugins/class-stripe-api.php index 25f0e0c09..7babe4236 100644 --- a/inc/plugins/class-stripe-api.php +++ b/inc/plugins/class-stripe-api.php @@ -35,7 +35,7 @@ class Stripe_API { * @access public */ public function __construct() { - if ( ! self::has_keys() && empty( $client ) ) { + if ( ! self::has_keys() ) { return; }