Skip to content

Commit 2cd09f6

Browse files
authored
Merge branch 'master' into issue/161
2 parents 159e9c1 + e4dfc84 commit 2cd09f6

File tree

8 files changed

+706
-44
lines changed

8 files changed

+706
-44
lines changed

.github/workflows/phpunit-ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,36 @@ jobs:
1818
# Based on WordPress version requirements and PHP compatibility
1919
# Note: WordPress officially only supports PHPUnit up to 7.x
2020
include:
21+
# WordPress trunk (development) - PHP 7.2+
22+
- wordpress: "trunk"
23+
php: "8.3"
24+
phpunit: "9"
25+
wp-version: "trunk"
26+
27+
# WordPress 6.9 - PHP 7.2+
28+
- wordpress: "6.9"
29+
php: "8.3"
30+
phpunit: "9"
31+
wp-version: "6.9"
32+
- wordpress: "6.9"
33+
php: "8.2"
34+
phpunit: "9"
35+
wp-version: "6.9"
36+
37+
# WordPress 6.8 - PHP 7.2+
38+
- wordpress: "6.8"
39+
php: "8.3"
40+
phpunit: "9"
41+
wp-version: "6.8"
42+
- wordpress: "6.8"
43+
php: "8.2"
44+
phpunit: "9"
45+
wp-version: "6.8"
46+
- wordpress: "6.8"
47+
php: "8.1"
48+
phpunit: "9"
49+
wp-version: "6.8"
50+
2151
# WordPress 6.7+ (latest) - PHP 7.2+
2252
- wordpress: "latest"
2353
php: "8.3"

TESTING.md

Lines changed: 74 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,41 @@ The testing matrix is designed to validate the plugin against various combinatio
1515
### PHPUnit Version Requirements
1616

1717
| PHPUnit Version | PHP Requirement | WordPress Compatibility | Configuration File |
18-
|----------------|-----------------|------------------------|-------------------|
19-
| PHPUnit 9.x | PHP 7.3+ | All versions | phpunit.xml.dist |
20-
| PHPUnit 8.x | PHP 7.2+ | All versions | phpunit.xml.legacy |
21-
| PHPUnit 7.x | PHP 7.1+ | WP 4.9 - 6.x | phpunit.xml.legacy |
18+
|-----------------|-----------------|-------------------------|--------------------|
19+
| PHPUnit 9.x | PHP 7.3+ | All versions | phpunit.xml.dist |
20+
| PHPUnit 8.x | PHP 7.2+ | All versions | phpunit.xml.legacy |
21+
| PHPUnit 7.x | PHP 7.1+ | WP 4.9 - 6.x | phpunit.xml.legacy |
2222

2323
### WordPress Version Requirements
2424

2525
| WordPress Version | Minimum PHP | Recommended PHP |
26-
|------------------|-------------|-----------------|
27-
| 6.7 (latest) | 7.2.24 | 8.0+ |
28-
| 6.4 - 6.6 | 7.2.24 | 8.0+ |
29-
| 6.0 - 6.3 | 7.2.24 | 7.4+ |
30-
| 5.9 | 7.2.24 | 7.4+ |
31-
| 5.5 - 5.8 | 7.2.0 | 7.4+ |
26+
|-------------------|-------------|-----------------|
27+
| trunk | 7.2.24 | 8.0+ |
28+
| 6.4 - 6.9 | 7.2.24 | 8.0+ |
29+
| 6.0 - 6.3 | 7.2.24 | 7.4+ |
30+
| 5.9 | 7.2.24 | 7.4+ |
31+
| 5.5 - 5.8 | 7.2.0 | 7.4+ |
3232

3333
## Test Matrix Configuration
3434

3535
The GitHub Actions workflow (`.github/workflows/phpunit-ci.yml`) runs tests across the following combinations:
3636

37-
### Latest WordPress (6.7+)
37+
### WordPress trunk (development)
38+
39+
- PHP 8.3 + PHPUnit 9
40+
41+
### WordPress 6.9
42+
43+
- PHP 8.3 + PHPUnit 9
44+
- PHP 8.2 + PHPUnit 9
45+
46+
### WordPress 6.8
47+
48+
- PHP 8.3 + PHPUnit 9
49+
- PHP 8.2 + PHPUnit 9
50+
- PHP 8.1 + PHPUnit 9
51+
52+
### Latest WordPress (6.7)
3853

3954
- PHP 8.3 + PHPUnit 9
4055
- PHP 8.2 + PHPUnit 9
@@ -111,6 +126,54 @@ bash bin/install-wp-tests.sh wordpress_test wp wp localhost $WP_VERSION
111126
./vendor/bin/phpunit
112127
```
113128

129+
### Running Specific Test Groups
130+
131+
Tests are organized using PHPUnit groups for easy filtering:
132+
133+
**Run all upload path tests:**
134+
135+
```bash
136+
./vendor/bin/phpunit --group=upload
137+
```
138+
139+
**Run tests by ticket number:**
140+
141+
```bash
142+
./vendor/bin/phpunit --group=136
143+
```
144+
145+
**Run specific test groups:**
146+
147+
```bash
148+
# Files rewriting tests
149+
./vendor/bin/phpunit --group=files-rewriting
150+
151+
# Multisite configuration tests
152+
./vendor/bin/phpunit --group=multisite
153+
154+
# Subdirectory installation tests
155+
./vendor/bin/phpunit --group=subdirectory
156+
```
157+
158+
**Run a single test class:**
159+
160+
```bash
161+
./vendor/bin/phpunit tests/integration/tests/test-upload-paths.php
162+
```
163+
164+
**Run a specific test method:**
165+
166+
```bash
167+
./vendor/bin/phpunit --filter test_upload_path_without_duplication
168+
```
169+
170+
**Verbose and debug output:**
171+
172+
```bash
173+
./vendor/bin/phpunit --group=upload --verbose
174+
./vendor/bin/phpunit --group=upload --debug
175+
```
176+
114177
### Testing with Docker
115178

116179
You can test different PHP versions using Docker:

tests/integration/tests/test-networkoperations.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,28 @@ public function test_switch_to_network() {
6565

6666
$this->assertEquals( 1, $current_site->id, 'Switching back should switch the network' );
6767
}
68+
69+
public function test_update_network_clears_cache() {
70+
// Create a test network.
71+
$network_id = $this->factory->network->create(
72+
array(
73+
'domain' => 'example.com',
74+
'path' => '/test/',
75+
)
76+
);
77+
78+
// Get the network to populate cache.
79+
$network = get_network( $network_id );
80+
$this->assertEquals( 'example.com', $network->domain, 'Network should have original domain' );
81+
$this->assertEquals( '/test/', $network->path, 'Network should have original path' );
82+
83+
// Update the network with new domain and path.
84+
$result = update_network( $network_id, 'newdomain.com', '/newpath/' );
85+
$this->assertTrue( $result, 'Network update should succeed' );
86+
87+
// Get the network again - it should reflect the updated values.
88+
$updated_network = get_network( $network_id );
89+
$this->assertEquals( 'newdomain.com', $updated_network->domain, 'Network should have updated domain without manual cache flush' );
90+
$this->assertEquals( '/newpath/', $updated_network->path, 'Network should have updated path without manual cache flush' );
91+
}
6892
}

0 commit comments

Comments
 (0)