File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 strategy :
2828 fail-fast : true
2929 matrix :
30- php : ["7.4 ", "8.4"]
30+ php : ["8.1 ", "8.4"]
3131
3232 name : PHP ${{ matrix.php }}
3333 steps :
5555 with :
5656 # caching node_modules
5757 path : vendor
58- key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
58+ key : ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5959 restore-keys : |
6060 ${{ runner.os }}-build-${{ env.cache-name }}-
6161 ${{ runner.os }}-build-
@@ -131,10 +131,8 @@ jobs:
131131 run : ./tests/install-wp-tests.sh wordpress_test root rootpassword 127.0.0.0 latest
132132 shell : bash
133133
134- - name : PHPunit
134+ - name : PHPUnit
135135 run : |
136- composer require "phpunit/phpunit=8.*"
137- composer require "yoast/phpunit-polyfills"
138- vendor/phpunit/phpunit/phpunit --version
139- WP_MULTISITE=1 vendor/phpunit/phpunit/phpunit
136+ vendor/bin/phpunit --version
137+ WP_MULTISITE=1 vendor/bin/phpunit
140138
Original file line number Diff line number Diff line change @@ -19,13 +19,20 @@ npm run build # Build CSS/JS for production (Vite)
1919``` bash
2020npm run lint # Run ESLint
2121npm run prettier # Format JS files with Prettier
22- composer install # Install PHP dependencies (required for PHPCS )
22+ composer install # Install PHP dependencies (PHPCS, PHPUnit, etc.; requires PHP >= 8.1 )
2323./tests/test_phpcs.sh # Run PHP CodeSniffer
2424./tests/test_phpcs.sh file.php # Run PHPCS on specific files
2525./vendor/bin/phpcbf # Auto-fix PHPCS errors
2626./tests/test_eslint.sh # Run ESLint + Prettier check
2727```
2828
29+ ### PHPUnit (after WordPress test lib install)
30+ ``` bash
31+ ./tests/install-wp-tests.sh < db-name> < db-user> < db-pass> [db-host]
32+ composer install
33+ composer run test # or: WP_MULTISITE=1 vendor/bin/phpunit
34+ ```
35+
2936## Architecture
3037
3138### Core Module Structure
@@ -92,7 +99,7 @@ Husky runs lint-staged on commit:
9299## CI Requirements
93100
94101Pull requests must pass:
95- 1 . PHP syntax check
102+ 1 . PHP syntax check (PHP 8.1+ in CI)
961032 . PHPCS on changed PHP files
971043 . ESLint + Prettier
981054 . Vite build (compiled assets must match expected output)
Original file line number Diff line number Diff line change 11{
2+ "require" : {
3+ "php" : " >=8.1" ,
4+ "kucrut/vite-for-wp" : " ^0.12.0"
5+ },
26 "require-dev" : {
3- "dealerdirect/phpcodesniffer-composer-installer" : " 1.*" ,
4- "wp-coding-standards/wpcs" : " 3.1.*" ,
5- "squizlabs/php_codesniffer" : " *"
7+ "dealerdirect/phpcodesniffer-composer-installer" : " ^1.2" ,
8+ "phpunit/phpunit" : " ^9.6" ,
9+ "squizlabs/php_codesniffer" : " ^3.13.5" ,
10+ "wp-coding-standards/wpcs" : " ^3.3" ,
11+ "yoast/phpunit-polyfills" : " ^4.0"
612 },
713 "scripts" : {
814 "lint" : " vendor/bin/phpcs" ,
9- "lintfix" : " vendor/bin/phpcbf"
15+ "lintfix" : " vendor/bin/phpcbf" ,
16+ "test" : " vendor/bin/phpunit"
1017 },
1118 "config" : {
1219 "allow-plugins" : {
1320 "dealerdirect/phpcodesniffer-composer-installer" : true
1421 }
15- },
16- "require" : {
17- "kucrut/vite-for-wp" : " ^0.12.0"
1822 }
1923}
Original file line number Diff line number Diff line change 181181
182182 <!-- Keeping these ones: -->
183183 <rule ref =" Generic.ControlStructures.InlineControlStructure" />
184- <rule ref =" Generic.Debug.ClosureLinter" />
185184 <rule ref =" Generic.Files.ByteOrderMark" />
186185 <rule ref =" Generic.Files.LineEndings" />
187186 <rule ref =" Generic.Formatting.DisallowMultipleStatements" />
196195 <rule ref =" Generic.WhiteSpace.ScopeIndent" >
197196 <properties >
198197 <property name =" indent" value =" 4" />
199- <property name =" ignoreIndentationTokens" type =" array" value =" T_COMMENT,T_DOC_COMMENT_OPEN_TAG" />
198+ <property name =" ignoreIndentationTokens" type =" array" >
199+ <element value =" T_COMMENT" />
200+ <element value =" T_DOC_COMMENT_OPEN_TAG" />
201+ </property >
200202 </properties >
201203 </rule >
202204 <rule ref =" PSR2.ControlStructures.ElseIfDeclaration" />
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" ?>
22<phpunit
3+ xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi:noNamespaceSchemaLocation=" https://schema.phpunit.de/9.6/phpunit.xsd"
35 bootstrap=" tests/bootstrap.php"
46 backupGlobals=" false"
57 colors=" true"
Original file line number Diff line number Diff line change 55 * @package Disciple.Tools
66 */
77
8+ $ autoload = dirname ( __DIR__ ) . '/vendor/autoload.php ' ;
9+ if ( file_exists ( $ autoload ) ) {
10+ require_once $ autoload ;
11+ }
12+
813$ _tests_dir = getenv ( 'WP_TESTS_DIR ' );
914
1015if ( !$ _tests_dir ) {
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ install_db() {
138138
139139 if ! [ -z $DB_HOSTNAME ] ; then
140140 if [ $( echo $DB_SOCK_OR_PORT | grep -e ' ^[0-9]\{1,\}$' ) ]; then
141- EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp "
141+ EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT "
142142 elif ! [ -z $DB_SOCK_OR_PORT ] ; then
143143 EXTRA=" --socket=$DB_SOCK_OR_PORT "
144144 elif ! [ -z $DB_HOSTNAME ] ; then
Original file line number Diff line number Diff line change 44
55cd " $( dirname " ${BASH_SOURCE[0]} " ) /../"
66
7- if [ " $( php -r ' echo version_compare( phpversion(), "7.0 ", ">=" ) ? 1 : 0;' ) " != 1 ] ; then
7+ if [ " $( php -r ' echo version_compare( phpversion(), "8.1 ", ">=" ) ? 1 : 0;' ) " != 1 ] ; then
88 vendor/bin/phpcs functions.php
99 exit
1010fi
1111
12- eval vendor/bin/phpcs $args
12+ vendor/bin/phpcs " $@ "
You can’t perform that action at this time.
0 commit comments