Skip to content

Commit

Permalink
Fix new tests for older WordPress versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz committed Jul 17, 2024
1 parent 8ed28cc commit 9bd99d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function test_enqueue() {
// Script modules are only supported in WordPress 6.5 and later.
if ( version_compare( $GLOBALS['wp_version'], '6.5', '<' ) ) {
$this->expectDoingItWrong( Script_Module_Registry::class . '::enqueue' );
$this->assertFalse( $this->registry->enqueue( 'test_script_module' ) );
$this->registry->enqueue( 'test_script_module' );
return;
}

Expand All @@ -172,7 +172,7 @@ public function test_dequeue() {
// Script modules are only supported in WordPress 6.5 and later.
if ( version_compare( $GLOBALS['wp_version'], '6.5', '<' ) ) {
$this->expectDoingItWrong( Script_Module_Registry::class . '::dequeue' );
$this->assertFalse( $this->registry->dequeue( 'test_script_module' ) );
$this->registry->dequeue( 'test_script_module' );
return;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/Dependencies/Script_Registry_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function test_add_inline_code() {
$this->registry->add_inline_code( 'test_script', $js );

if ( ! method_exists( wp_scripts(), 'get_inline_script_data' ) ) {
$this->assertSame( array( $js ), wp_scripts()->get_data( 'test_script', 'after' ) );
$this->assertSame( array( $js ), array_filter( wp_scripts()->get_data( 'test_script', 'after' ) ) );
} else {
$this->assertSame( $js, wp_scripts()->get_inline_script_data( 'test_script' ) );
}
Expand Down

0 comments on commit 9bd99d4

Please sign in to comment.