diff --git a/tests/WPStrava/ActivityTest.php b/tests/WPStrava/ActivityTest.php index 0378568..5a8e0b8 100644 --- a/tests/WPStrava/ActivityTest.php +++ b/tests/WPStrava/ActivityTest.php @@ -54,4 +54,58 @@ class WPStrava_ActivityTest extends TestCase { $actual = $this->activity->get_activities_longer_than( $this->activities, '10' ); $this->assertEquals( $expected, $actual ); } + + /** + * Test that links with a title are rendered correctly. + * + * @author Justin Foell + * @since 2.3.2 + */ + public function test_activity_link_with_title() { + $activity_name = 'Chill Day'; + $activity_id = 123456778928065; + + $expected = "{$activity_name}"; + $actual = $this->activity->get_activity_link( $activity_id, $activity_name, $activity_name ); + + $this->assertEquals( $expected, $actual ); + } + + /** + * Test that links with no title are rendered correctly. + * + * @author Justin Foell + * @since 2.3.2 + */ + public function test_activity_link_no_title() { + $activity_name = 'Chill Day'; + $activity_id = 123456778928065; + + $expected = "{$activity_name}"; + $actual = $this->activity->get_activity_link( $activity_id, $activity_name ); + + $this->assertEquals( $expected, $actual ); + } + + /** + * Test that links with no_link set just render the supplied text. + * + * @author Justin Foell + * @since 2.3.2 + */ + public function test_activity_no_link() { + \WP_Mock::userFunction( + 'get_option', + array( + 'args' => 'strava_no_link', + 'times' => 1, + 'return' => true, + ) + ); + + $activity_name = 'Afternoon Ride'; + $actual = $this->activity->get_activity_link( 123456778928065, 'Afternoon Ride' ); + + $this->assertEquals( $activity_name, $actual ); + } }