Commit fe29677
committed
test: add wu_create_site integration tests for subdomain slug sanitization
Adds two integration tests to Site_Functions_Extended_Test that verify
the subdomain slug sanitization introduced in GH#812 (PR #822) works
end-to-end at the wu_create_site() API level:
- test_create_site_sanitizes_subdomain_slug: verifies that a path with
special characters (e.g. '/My Cool Site!/') produces a sanitized
subdomain hostname containing 'my-cool-site' and does NOT fail with
'invalid_site_path'.
- test_create_site_returns_error_for_empty_subdomain_slug: verifies that
a path of only invalid characters (e.g. '/!!!/') returns WP_Error with
'invalid_site_path', preventing malformed hostnames.
To make these tests runnable in the subdirectory test environment (where
is_subdomain_install() checks the SUBDOMAIN_INSTALL constant), a new
filter 'wu_is_subdomain_install' wraps the is_subdomain_install() call
in wu_create_site(). Tests override via add_filter('wu_is_subdomain_install',
'__return_true') to force the subdomain code path without redefining constants.
Resolves #8261 parent e6629f5 commit fe29677
File tree
2 files changed
+61
-1
lines changed- inc/functions
- tests/WP_Ultimo/Functions
2 files changed
+61
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| |||
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
262 | 322 | | |
0 commit comments