From 1c8ebd5da639f192316b2bde115e033a345f55f1 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 5 Jul 2020 19:22:24 +0000 Subject: [PATCH] Build/Test Tools: update PHPUnit tests after [48323]. Disable and keep the specific jQuery Migrate dependency tests for use in WP 5.6. See #37110. git-svn-id: https://develop.svn.wordpress.org/trunk@48324 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/dependencies/jquery.php | 13 ++++++++++++- tests/phpunit/tests/dependencies/scripts.php | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/tests/dependencies/jquery.php b/tests/phpunit/tests/dependencies/jquery.php index 30ea876e2f..1d763b0382 100644 --- a/tests/phpunit/tests/dependencies/jquery.php +++ b/tests/phpunit/tests/dependencies/jquery.php @@ -21,6 +21,11 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase { $object = $scripts->query( 'jquery', 'registered' ); $this->assertInstanceOf( '_WP_Dependency', $object ); + + // As of 5.5 jQuery 1.12.4 is loaded without Migrate 1.4.1. + // Disable, but keep the followint test for 5.6 when jQuery would be updated to 3.5.1+ and + // the latest Migrate will be used. + /* $this->assertEqualSets( $object->deps, array_keys( $jquery_scripts ) ); foreach ( $object->deps as $dep ) { $o = $scripts->query( $dep, 'registered' ); @@ -28,6 +33,7 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase { $this->assertTrue( isset( $jquery_scripts[ $dep ] ) ); $this->assertEquals( $jquery_scripts[ $dep ], $o->src ); } + */ } function test_presence_of_jquery_no_conflict() { @@ -113,7 +119,8 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase { $scripts->add_data( $dep, 'group', 1 ); } - $this->expectOutputRegex( '/^(?:]+><\/script>\\n){2}$/' ); + // Match only one script tag fopr 5.5, revert to `{2}` for 5.6. + $this->expectOutputRegex( '/^(?:]+><\/script>\\n)$/' ); $scripts->do_items( false, 0 ); $this->assertNotContains( 'jquery', $scripts->done ); @@ -122,7 +129,11 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase { $scripts->do_items( false, 1 ); $this->assertContains( 'jquery', $scripts->done ); + + // Disable for 5.5 but keep for use in 5.6. See test_location_of_jquery() above. + /* $this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' ); $this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' ); + */ } } diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index ede0830511..093f02f1e9 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -632,7 +632,7 @@ JS; $wp_scripts->do_concat = true; $ver = get_bloginfo( 'version' ); - $expected = "\n"; + $expected = "\n"; $expected .= "\n"; $expected .= "\n"; @@ -657,7 +657,7 @@ JS; $wp_scripts->do_concat = true; $ver = get_bloginfo( 'version' ); - $expected = "\n"; + $expected = "\n"; $expected .= "