Skip to content

Commit eafde4a

Browse files
committed
fix issues with tests, docker and data
1 parent bfa235d commit eafde4a

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@
12821282
"web_application_firewall",
12831283
"module_firewall"
12841284
],
1285-
"default": "[]",
1285+
"default": [],
12861286
"type": "array",
12871287
"link_info": "https://clk.shldscrty.com/2a",
12881288
"link_blog": "",

tests/Unit/Configuration/PluginOptionsSchemaTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ class PluginOptionsSchemaTest extends TestCase {
2121
protected function set_up() :void {
2222
parent::set_up();
2323
$config = $this->loadConfig();
24-
$this->options = $config['config_spec']['options'] ?? [];
24+
25+
// Convert options array to keyed format for easier lookup
26+
// plugin.json stores options as: [ { "key": "option_name", ... }, ... ]
27+
// We convert to: [ "option_name" => { "key": "option_name", ... }, ... ]
28+
$rawOptions = $config['config_spec']['options'] ?? [];
29+
$this->options = [];
30+
foreach ( $rawOptions as $option ) {
31+
if ( isset( $option['key'] ) ) {
32+
$this->options[$option['key']] = $option;
33+
}
34+
}
35+
2536
$this->sections = $config['config_spec']['sections'] ?? [];
2637
}
2738

tests/Unit/Rules/PerformConditionMatchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public static function providerSqlInjectionPatterns() :array {
6060
false
6161
],
6262
'or 1=1 bypass' => [
63-
"#'\\s*or\\s*'?\\d+\\s*=\\s*'?\\d+#i",
63+
"#'\\s*or\\s*'?\\d+'?\\s*=\\s*'?\\d+#i",
6464
"admin' OR '1'='1",
6565
true
6666
],
6767
'or 1=1 numeric' => [
68-
"#'\\s*or\\s*'?\\d+\\s*=\\s*'?\\d+#i",
68+
"#'\\s*or\\s*'?\\d+'?\\s*=\\s*'?\\d+#i",
6969
"admin' OR 1=1--",
7070
true
7171
],

tests/docker/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,17 @@ FROM php-runtime AS test-framework
8080
ARG PHP_VERSION
8181

8282
# Install PHPUnit based on PHP version compatibility
83-
# PHPUnit 9.x: PHP 7.3 - 8.0
84-
# PHPUnit 10.x: PHP 8.1+ (supports 8.1, 8.2, 8.3, 8.4)
85-
# yoast/phpunit-polyfills 4.x: Supports PHPUnit 7.5 - 12.x and PHP 7.1+
86-
RUN if [ "$(echo ${PHP_VERSION} | cut -d. -f1)" = "7" ] || [ "${PHP_VERSION}" = "8.0" ]; then \
83+
# PHPUnit 9.6: PHP >=7.3 (works with 7.4, 8.0, 8.1)
84+
# PHPUnit 11.x: PHP >=8.2 (works with 8.2, 8.3, 8.4)
85+
# Note: PHPUnit 10.x is NOT supported by yoast/phpunit-polyfills 4.x
86+
# yoast/phpunit-polyfills 4.x: Supports PHPUnit ^7.5|^8.0|^9.0|^11.0|^12.0
87+
RUN if [ "$(echo ${PHP_VERSION} | cut -d. -f1)" = "7" ] || [ "${PHP_VERSION}" = "8.0" ] || [ "${PHP_VERSION}" = "8.1" ]; then \
8788
composer global require --no-interaction --no-cache \
8889
phpunit/phpunit:^9.6 \
8990
yoast/phpunit-polyfills:^4.0; \
9091
else \
9192
composer global require --no-interaction --no-cache \
92-
phpunit/phpunit:^10.5 \
93+
phpunit/phpunit:^11.5 \
9394
yoast/phpunit-polyfills:^4.0; \
9495
fi
9596

0 commit comments

Comments
 (0)