mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Props hauvong, peterwilsoncc, SergeyBiryukov Fixes #51839 git-svn-id: https://develop.svn.wordpress.org/trunk@50354 602fd350-edb4-49c9-b593-d223f7449a82
68 lines
1.8 KiB
PHP
68 lines
1.8 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group link
|
|
* @covers ::get_feed_link
|
|
*/
|
|
class Tests_Link_GetFeedLink extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* @ticket 51839
|
|
* @dataProvider data_plain_permastruct
|
|
*
|
|
* @param string $expected Expected suffix to home_url().
|
|
* @param string $type Feed type to request.
|
|
*/
|
|
public function tests_plain_permastruct( $expected, $type ) {
|
|
$this->set_permalink_structure( '' );
|
|
|
|
$this->assertSame( home_url( $expected ), get_feed_link( $type ) );
|
|
}
|
|
|
|
public function data_plain_permastruct() {
|
|
return array(
|
|
array( '?feed=rss2', '' ),
|
|
array( '?feed=atom', 'atom' ),
|
|
array( '?feed=get-feed-link', 'get-feed-link' ),
|
|
array( '?feed=comments-rss2', 'comments_rss2' ),
|
|
array( '?feed=comments-atom', 'comments_atom' ),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @ticket 51839
|
|
* @dataProvider data_pretty_permastruct
|
|
*
|
|
* @param string $expected Expected suffix to home_url().
|
|
* @param string $type Feed type to request.
|
|
*/
|
|
public function tests_pretty_permastruct( $expected, $type ) {
|
|
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
|
|
|
$this->assertSame( home_url( $expected ), get_feed_link( $type ) );
|
|
}
|
|
|
|
/**
|
|
* @ticket 51839
|
|
* @dataProvider data_pretty_permastruct
|
|
*
|
|
* @param string $expected Expected suffix to home_url().
|
|
* @param string $type Feed type to request.
|
|
*/
|
|
public function tests_pretty_permastruct_with_prefix( $expected, $type ) {
|
|
$this->set_permalink_structure( '/archives/%post_id%/%postname%/' );
|
|
|
|
$this->assertSame( home_url( $expected ), get_feed_link( $type ) );
|
|
}
|
|
|
|
public function data_pretty_permastruct() {
|
|
return array(
|
|
array( '/feed/', '' ),
|
|
array( '/feed/atom/', 'atom' ),
|
|
array( '/feed/get-feed-link/', 'get-feed-link' ),
|
|
array( '/comments/feed/', 'comments_rss2' ),
|
|
array( '/comments/feed/atom/', 'comments_atom' ),
|
|
);
|
|
}
|
|
}
|