diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 5f1679b..e1699c1 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -21,20 +21,16 @@ jobs: run: | composer install npm install - - name: Setup MySQL + - name: Start MySQL run: | sudo /etc/init.d/mysql start - mysql -e 'CREATE DATABASE IF NOT EXISTS wordpress_test;' -uroot -proot - mysql -e 'SHOW DATABASES;' -uroot -proot - - name: Install WP Unit tests - run: | - php -v mysqladmin -V - bash .bin/install-wp-tests.sh wordpress_test root root localhost latest true + - name: Setup WP-CLI + uses: godaddy-wordpress/setup-wp-cli@1 - name: Run linter run: composer lint - name: Run tests - run: composer test + run: bash ./bin/phpunit-test.sh wporg-code-analysis: runs-on: ubuntu-latest name: WP.org Code Analysis diff --git a/.gitignore b/.gitignore index f387a82..cbb240f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,12 @@ node_modules/ /vendor/ +# WPUnit Helpers +bin/helpers.sh +bin/install-local-tests.sh +bin/install-wp-tests.sh +bin/phpunit-test.sh + # Built files assets/css/*.css assets/css/*.css.map diff --git a/composer.json b/composer.json index 70c701a..0bcb091 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "pantheon-systems/pantheon-wp-coding-standards": "^2.0", "pantheon-systems/pantheon-wordpress-upstream-tests": "dev-master", "phpunit/phpunit": "^9", - "yoast/phpunit-polyfills": "^1.0" + "yoast/phpunit-polyfills": "^1.0", + "pantheon-systems/wpunit-helpers": "^2.0" }, "scripts": { "lint": [ @@ -26,11 +27,14 @@ "phpcs": "vendor/bin/phpcs -s .", "phpcbf": "vendor/bin/phpcbf", "phpunit": "vendor/bin/phpunit", - "test": "@phpunit" + "test": "@phpunit", + "test:install": "bin/install-local-tests.sh --skip-db=true", + "test:install:withdb": "bin/install-local-tests.sh" }, "config": { "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "pantheon-systems/wpunit-helpers": true } } } diff --git a/composer.lock b/composer.lock index 4440a7c..f262196 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f3f28993d72e782b110511c37a4ab5c1", + "content-hash": "bc62875379c611a26e8ebe2bd9a4ce83", "packages": [], "packages-dev": [ { @@ -1267,6 +1267,52 @@ }, "time": "2023-12-12T16:18:18+00:00" }, + { + "name": "pantheon-systems/wpunit-helpers", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/pantheon-systems/wpunit-helpers.git", + "reference": "8e767a2d59abc16b4fc5bedc12e0adbb87554044" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pantheon-systems/wpunit-helpers/zipball/8e767a2d59abc16b4fc5bedc12e0adbb87554044", + "reference": "8e767a2d59abc16b4fc5bedc12e0adbb87554044", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0" + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "composer-plugin", + "extra": { + "class": "Pantheon\\WPUnitHelpers\\Plugin" + }, + "autoload": { + "psr-4": { + "Pantheon\\WPUnitHelpers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pantheon", + "email": "noreply@pantheon.io" + } + ], + "description": "Unified scripts for installing and running automated WP Unit Tests.", + "support": { + "issues": "https://github.com/pantheon-systems/wpunit-helpers/issues", + "source": "https://github.com/pantheon-systems/wpunit-helpers/tree/v2.0.2" + }, + "time": "2025-01-06T18:07:41+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -5700,7 +5746,7 @@ }, "prefer-stable": true, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" }