Skip to content

Commit 1ecf613

Browse files
committed
Test SQLite installation authorization
Run dedicated WordPress PHPUnit coverage in single-site and multisite modes. Verify subsite administrators cannot reach the UI or mutation path even with a valid nonce, while administrators and super administrators retain their expected access.
1 parent 1c1ab7d commit 1ecf613

7 files changed

Lines changed: 869 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: SQLite Plugin PHPUnit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
# Disable permissions for all available scopes by default.
14+
# Any needed permissions should be configured at the job level.
15+
permissions: {}
16+
17+
jobs:
18+
test:
19+
name: SQLite Plugin PHPUnit Tests
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
permissions:
23+
contents: read # Required to clone the repo.
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Set UID and GID for PHP in WordPress images
33+
run: |
34+
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
35+
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
36+
37+
- name: Run SQLite plugin single-site PHPUnit tests
38+
run: composer run wp-test-sqlite-plugin-php
39+
40+
- name: Run SQLite plugin multisite PHPUnit tests
41+
run: composer run wp-test-sqlite-plugin-php-multisite
42+
43+
- name: Stop Docker containers
44+
if: always()
45+
run: composer run wp-test-clean

‎AGENTS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ composer run test # Run unit tests
4545
composer run test tests/SomeTest.php # Run specific unit test file
4646
composer run test -- --filter testName # Run specific unit test class/method
4747

48+
# SQLite Database Integration plugin PHPUnit tests
49+
composer run wp-test-sqlite-plugin-php # Run single-site plugin tests
50+
composer run wp-test-sqlite-plugin-php-multisite # Run multisite plugin tests
51+
4852
# SQLite Database Integration plugin E2E tests
4953
composer run test-e2e # Run E2E tests (Playwright via WP env)
5054

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ composer run test # Run unit tests
4343
composer run test tests/SomeTest.php # Run specific unit test file
4444
composer run test -- --filter testName # Run specific unit test class/method
4545

46+
# SQLite Database Integration plugin PHPUnit tests
47+
composer run wp-test-sqlite-plugin-php # Run single-site plugin tests
48+
composer run wp-test-sqlite-plugin-php-multisite # Run multisite plugin tests
49+
4650
# SQLite Database Integration plugin E2E tests
4751
composer run test-e2e # Run E2E tests (Playwright via WP env)
4852

‎composer.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
"rm -rf wordpress/src/wp-content/database/.ht.sqlite @no_additional_args",
7070
"npm --prefix wordpress run test:php -- @additional_args"
7171
],
72+
"wp-test-sqlite-plugin-php": [
73+
"@wp-test-php /var/www/tests-sqlite-database-integration/phpunit/WP_SQLite_Database_Integration_Authorization_Tests.php"
74+
],
75+
"wp-test-sqlite-plugin-php-multisite": [
76+
"@wp-test-php -c tests/phpunit/multisite.xml /var/www/tests-sqlite-database-integration/phpunit/WP_SQLite_Database_Integration_Authorization_Tests.php"
77+
],
7278
"wp-test-e2e": [
7379
"@wp-test-ensure-env @no_additional_args",
7480
"npm --prefix wordpress run test:e2e -- @additional_args"

0 commit comments

Comments
 (0)