diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php index 51bb0468d4..b31c165692 100644 --- a/tests/phpunit/tests/l10n.php +++ b/tests/phpunit/tests/l10n.php @@ -407,17 +407,12 @@ class Tests_L10n extends WP_UnitTestCase { $this->factory()->post->create( $args ); - // Effectively ignore the output until retrieving it later via `getActualOutput()`. - $this->expectOutputRegex( '`.`' ); - $expect = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do…'; + $this->expectOutputRegex( '/' . $expect . '/' ); + wp_dashboard_recent_drafts(); - $actual = $this->getActualOutput(); - restore_previous_locale(); - - $this->assertMatchesRegularExpression( '/' . $expect . '/', $actual ); } /** @@ -436,17 +431,12 @@ class Tests_L10n extends WP_UnitTestCase { $post = $this->factory()->post->create( $args ); - // Effectively ignore the output until retrieving it later via `getActualOutput()`. - $this->expectOutputRegex( '`.`' ); - $expect = 'Lorem ipsum dolor sit amet, consectetur …'; + $this->expectOutputRegex( '/' . $expect . '/' ); + wp_dashboard_recent_drafts(); - $actual = $this->getActualOutput(); - restore_previous_locale(); - - $this->assertMatchesRegularExpression( '/' . $expect . '/', $actual ); } /** @@ -465,17 +455,12 @@ class Tests_L10n extends WP_UnitTestCase { $this->factory()->post->create( $args ); - // Effectively ignore the output until retrieving it later via `getActualOutput()`. - $this->expectOutputRegex( '`.`' ); - $expect = str_repeat( 'あ', 40 ) . '…'; + $this->expectOutputRegex( '/' . $expect . '/' ); + wp_dashboard_recent_drafts(); - $actual = $this->getActualOutput(); - restore_previous_locale(); - - $this->assertMatchesRegularExpression( '/' . $expect . '/', $actual ); } /** diff --git a/tests/phpunit/tests/widgets.php b/tests/phpunit/tests/widgets.php index 36e9b684f6..7cfce4719b 100644 --- a/tests/phpunit/tests/widgets.php +++ b/tests/phpunit/tests/widgets.php @@ -611,8 +611,7 @@ class Tests_Widgets extends WP_UnitTestCase { } ); - // Effectively ignore the output until retrieving it later via `getActualOutput()`. - $this->expectOutputRegex( '`.`' ); + $this->expectOutputRegex( '/Test Title/' ); $widget->display_callback( array( @@ -624,11 +623,7 @@ class Tests_Widgets extends WP_UnitTestCase { 2 ); - $actual = $this->getActualOutput(); - unregister_widget( $widget ); - - $this->assertStringContainsString( 'Test Title', $actual ); } /**