Skip to content

Commit

Permalink
Fix WPCS errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Feb 3, 2025
1 parent 6827503 commit 4d54a08
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/phpunit/tests/speculative-loading/wpSpeculationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
true
true,
),
'basic-prefetch-no-source' => array(
'prefetch',
Expand All @@ -72,16 +72,16 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
true
true,
),
'basic-prefetch-no-eagerness' => array(
'prefetch',
'test-rule-3',
array(
'source' => 'document',
'where' => array( 'selector_matches' => '.prefetch' ),
'source' => 'document',
'where' => array( 'selector_matches' => '.prefetch' ),
),
true
true,
),
'basic-prerender' => array(
'prerender',
Expand All @@ -91,7 +91,7 @@ public static function data_add_rule(): array {
'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ),
'eagerness' => 'eager',
),
true
true,
),
'basic-prerender-no-source' => array(
'prerender',
Expand All @@ -100,7 +100,7 @@ public static function data_add_rule(): array {
'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ),
'eagerness' => 'eager',
),
true
true,
),
'basic-prerender-no-eagerness' => array(
'prerender',
Expand All @@ -109,7 +109,7 @@ public static function data_add_rule(): array {
'source' => 'list',
'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ),
),
true
true,
),
'invalid-mode' => array(
'load-fast', // Only 'prefetch' and 'prerender' are allowed.
Expand All @@ -119,7 +119,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
false
false,
),
'invalid-id-characters' => array(
'prefetch',
Expand All @@ -129,7 +129,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
false
false,
),
'invalid-id-start' => array(
'prefetch',
Expand All @@ -139,7 +139,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
false
false,
),
'invalid-source' => array(
'prerender',
Expand All @@ -149,13 +149,13 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prerender' ),
'eagerness' => 'eager',
),
false
false,
),
'missing-keys' => array(
'prefetch',
'test-rule-1',
array(), // The minimum requirements are presence of either a 'where' or 'urls' key.
false
false,
),
'conflicting-keys' => array(
'prefetch',
Expand All @@ -164,7 +164,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ),
),
false
false,
),
'conflicting-list-source' => array(
'prefetch',
Expand All @@ -174,7 +174,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'eager',
),
false
false,
),
'conflicting-document-source' => array(
'prefetch',
Expand All @@ -184,7 +184,7 @@ public static function data_add_rule(): array {
'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ),
'eagerness' => 'eager',
),
false
false,
),
'invalid-eagerness' => array(
'prefetch',
Expand All @@ -194,7 +194,7 @@ public static function data_add_rule(): array {
'where' => array( 'selector_matches' => '.prefetch' ),
'eagerness' => 'fast', // Only 'immediate', 'eager, 'moderate', and 'conservative' are allowed.
),
false
false,
),
);
}
Expand Down Expand Up @@ -226,13 +226,13 @@ public function test_to_array() {
$prefetch_rule_2 = array( 'where' => array( 'selector_matches' => '.prefetch-opt-in' ) );
$prerender_rule_1 = array( 'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ) );
$prerender_rule_2 = array(
'where' => array(
'where' => array(
'or' => array(
array( 'selector_matches' => '.prerender-opt-in' ),
array( 'selector_matches' => '.prerender-fast' ),
),
),
'eagerness' => 'moderate'
'eagerness' => 'moderate',
);

$speculation_rules = new WP_Speculation_Rules();
Expand Down Expand Up @@ -280,13 +280,13 @@ public function test_jsonSerialize() {
$prefetch_rule_2 = array( 'where' => array( 'selector_matches' => '.prefetch-opt-in' ) );
$prerender_rule_1 = array( 'urls' => array( 'https://example.org/high-priority-url/', 'https://example.org/another-high-priority-url/' ) );
$prerender_rule_2 = array(
'where' => array(
'where' => array(
'or' => array(
array( 'selector_matches' => '.prerender-opt-in' ),
array( 'selector_matches' => '.prerender-fast' ),
),
),
'eagerness' => 'moderate'
'eagerness' => 'moderate',
);

$speculation_rules = new WP_Speculation_Rules();
Expand Down

0 comments on commit 4d54a08

Please sign in to comment.