diff --git a/tests/phpunit/tests/formatting/Autop.php b/tests/phpunit/tests/formatting/Autop.php index 62251d78ca..b92af0f110 100644 --- a/tests/phpunit/tests/formatting/Autop.php +++ b/tests/phpunit/tests/formatting/Autop.php @@ -534,4 +534,28 @@ line 2
$this->assertEquals( $expected, trim( wpautop( $content ) ) ); } + + /** + * wpautop() should not add extra

before
+ * + * @covers ::wpautop + * @uses trim + * + * @ticket 39307 + */ + function test_that_wpautop_doses_not_add_extra_closing_p_in_figure() { + $content1 = $expected1 = '
Caption
'; + + $content2 = '
+ +
Caption
+
'; + + $expected2 = '
+
Caption
'; + + $this->assertEquals( $expected1, trim( wpautop( $content1 ) ) ); + $this->assertEquals( $expected2, trim( wpautop( $content2 ) ) ); + } + }