Compare commits

...
Author SHA1 Message Date
marcus 3c1db9d4fb Merge pull request #3 from wpallstars/fix/test-workflow
Release / Build and Release (push) Canceled after 0s
Fix test workflow issues with WP_Mock and PHP 7.0 compatibility
2025-04-18 15:53:29 +01:00
marcus bfa528c90e Fix test workflow issues with WP_Mock and PHP 7.0 compatibility 2025-04-18 15:46:16 +01:00
4 changed files with 21 additions and 5 deletions

No files matched your search

+11 -3
View File
@@ -1,4 +1,4 @@
name: Tests name: Tests - Run PHP compatibility and unit tests
on: on:
push: push:
@@ -27,7 +27,15 @@ jobs:
tools: composer:v2 tools: composer:v2
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress run: |
if [[ "${{ matrix.php-versions }}" == "7.0" ]]; then
composer require --dev phpunit/phpunit:"^6.5" --update-with-dependencies
composer require --dev 10up/wp_mock:"^0.4.2" --update-with-dependencies
composer require --dev antecedent/patchwork:"^2.1.21" --update-with-dependencies
else
composer install --prefer-dist --no-progress
composer require --dev 10up/wp_mock:"^0.4.2" --update-with-dependencies
fi
- name: Run tests - name: Run tests
run: ./vendor/bin/phpunit run: ./vendor/bin/phpunit
@@ -51,4 +59,4 @@ jobs:
run: composer install --prefer-dist --no-progress run: composer install --prefer-dist --no-progress
- name: Run PHPCS - name: Run PHPCS
run: ./vendor/bin/phpcs --standard=WordPress --runtime-set installed_paths vendor/wp-coding-standards/wpcs run: ./vendor/bin/phpcs --standard=WordPress --runtime-set installed_paths vendor/wp-coding-standards/wpcs ./includes ./admin ./wp-plugin-starter-template.php
+4
View File
@@ -8,6 +8,10 @@
// First, we need to load the composer autoloader so we can use WP Mock. // First, we need to load the composer autoloader so we can use WP Mock.
require_once dirname(__DIR__) . '/vendor/autoload.php'; require_once dirname(__DIR__) . '/vendor/autoload.php';
// Import WP_Mock class
use WP_Mock\Tools\TestCase;
use WP_Mock;
// Now call the bootstrap method of WP Mock. // Now call the bootstrap method of WP Mock.
WP_Mock::bootstrap(); WP_Mock::bootstrap();
+3 -1
View File
@@ -7,11 +7,13 @@
use WPALLSTARS\PluginStarterTemplate\Admin\Admin; use WPALLSTARS\PluginStarterTemplate\Admin\Admin;
use WPALLSTARS\PluginStarterTemplate\Core; use WPALLSTARS\PluginStarterTemplate\Core;
use WP_Mock\Tools\TestCase;
use WP_Mock;
/** /**
* Admin test case. * Admin test case.
*/ */
class AdminTest extends WP_Mock\Tools\TestCase { class AdminTest extends TestCase {
/** /**
* Test instance * Test instance
+3 -1
View File
@@ -6,11 +6,13 @@
*/ */
use WPALLSTARS\PluginStarterTemplate\Core; use WPALLSTARS\PluginStarterTemplate\Core;
use WP_Mock\Tools\TestCase;
use WP_Mock;
/** /**
* Core test case. * Core test case.
*/ */
class CoreTest extends WP_Mock\Tools\TestCase { class CoreTest extends TestCase {
/** /**
* Test instance * Test instance