From 0230cf7d70d6310c88e3416c58e6dafa5a4a2274 Mon Sep 17 00:00:00 2001 From: Alex Kirk Date: Fri, 9 Dec 2022 09:20:25 +0100 Subject: [PATCH] Restructure unit test to make it work again --- tests/test-class-activitypub-hashtag.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test-class-activitypub-hashtag.php b/tests/test-class-activitypub-hashtag.php index e7699d2..5c207bd 100644 --- a/tests/test-class-activitypub-hashtag.php +++ b/tests/test-class-activitypub-hashtag.php @@ -4,26 +4,26 @@ class Test_Activitypub_Hashtag extends WP_UnitTestCase { * @dataProvider the_content_provider */ public function test_the_content( $content, $content_with_hashtag ) { - $content = \Activitypub\Hashtag::the_content( $content ); - - $this->assertEquals( $content_with_hashtag, $content ); - } - - public function the_content_provider() { \wp_create_term( 'object', 'post_tag' ); $object = \get_term_by( 'name', 'object', 'post_tag' ); $link = \get_term_link( $object, 'post_tag' ); + $content = \Activitypub\Hashtag::the_content( $content ); + + $this->assertEquals( sprintf( $content_with_hashtag, $link ), $content ); + } + + public function the_content_provider() { return array( array( 'test', 'test' ), array( '#test', '#test' ), array( 'hallo #test test', 'hallo #test test' ), - array( 'hallo #object test', 'hallo test' ), - array( '#object test', ' test' ), + array( 'hallo #object test', 'hallo test' ), + array( '#object test', ' test' ), array( 'hallo test test', 'hallo test test' ), array( 'hallo #test test', 'hallo #test test' ), - array( '
hallo #object test
', '
hallo test
' ), - array( '
hallo #object
', '
hallo
' ), + array( '
hallo #object test
', '
hallo test
' ), + array( '
hallo #object
', '
hallo
' ), array( '
#object
', '
#object
' ), array( '#object', '#object' ), array( '
object', '
object' ),