Skip to content

Commit 2115fa9

Browse files
committed
Simplify test_filter_eligible_strategies_uses_cached_result_for_shared_dependency
1 parent 33e8d93 commit 2115fa9

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

tests/phpunit/tests/dependencies/scripts.php

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,42 +1593,14 @@ public function test_loading_strategy_with_valid_blocking_registration() {
15931593
/**
15941594
* Tests that `WP_Scripts::filter_eligible_strategies()` correctly reuses cached results for shared dependencies.
15951595
*
1596-
* This test uses a diamond-shaped dependency graph where 'a' depends on 'b' and 'c', and both 'b' and 'c' depend
1597-
* on 'd' (a diamond-shaped dependency graph). The goal is to confirm that when `$stored_results` already contains
1598-
* an entry for 'd', the cached value is reused instead of recalculating the strategies for 'd' multiple times.
1599-
*
16001596
* @ticket 64194
16011597
*
16021598
* @covers WP_Scripts::filter_eligible_strategies
16031599
*/
16041600
public function test_filter_eligible_strategies_uses_cached_result_for_shared_dependency() {
16051601
$wp_scripts = new WP_Scripts();
1606-
1607-
/*
1608-
* Register scripts forming a diamond-shaped dependency graph:
1609-
* D is the shared dependent of B and C, and A depends on both B and C.
1610-
*/
1611-
$wp_scripts->add( 'a', 'https://example.com/a.js', array( 'b', 'c' ) );
1612-
$wp_scripts->add( 'b', 'https://example.com/b.js', array( 'd' ) );
1613-
$wp_scripts->add( 'c', 'https://example.com/c.js', array( 'd' ) );
16141602
$wp_scripts->add( 'd', 'https://example.com/d.js' );
1615-
1616-
// Enqueue all scripts so they are treated as active/enqueued.
1617-
foreach ( array( 'a', 'b', 'c', 'd' ) as $handle ) {
1618-
$wp_scripts->enqueue( $handle );
1619-
}
1620-
1621-
/*
1622-
* Assign strategies:
1623-
* - A: async
1624-
* - B: async
1625-
* - C: async
1626-
* - D: async
1627-
*/
1628-
$wp_scripts->add_data( 'a', 'strategy', 'defer' );
1629-
$wp_scripts->add_data( 'b', 'strategy', 'defer' );
1630-
$wp_scripts->add_data( 'c', 'strategy', 'defer' );
1631-
$wp_scripts->add_data( 'd', 'strategy', 'async' );
1603+
$wp_scripts->add_data( 'd', 'strategy', 'defer' );
16321604

16331605
/*
16341606
* Simulate a cached result in `$stored_results` for D.

0 commit comments

Comments
 (0)