Changeset 63036 for trunk/tests/phpunit/tests/comment/wpAllowComment.php
- Timestamp:
- 08/06/2026 09:30:58 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/wpAllowComment.php
r53863 r63036 72 72 $result = wp_allow_comment( $comment_data ); 73 73 } 74 75 /** 76 * @ticket 65016 77 * 78 * @dataProvider data_should_approve_a_pingback_only_when_it_comes_from_this_site 79 * 80 * @param bool $is_self_ping Whether the pingback should come from this site. 81 * @param int $expected The expected approval status. 82 */ 83 public function test_should_approve_a_pingback_only_when_it_comes_from_this_site( $is_self_ping, $expected ) { 84 update_option( 'comment_previously_approved', '1' ); 85 86 $source_url = $is_self_ping 87 ? get_permalink( self::factory()->post->create() ) 88 : 'http://example.com/their-post/'; 89 90 $comment_data = array( 91 'comment_post_ID' => self::$post_id, 92 'comment_author' => 'The Linking Post', 93 'comment_author_email' => '', 94 'comment_author_url' => $source_url, 95 'comment_content' => '[…] an earlier post of mine […]', 96 'comment_author_IP' => '192.168.0.1', 97 'comment_parent' => 0, 98 'comment_date_gmt' => gmdate( 'Y-m-d H:i:s' ), 99 'comment_agent' => 'WordPress/6.8', 100 'comment_type' => 'pingback', 101 ); 102 103 $this->assertSame( $expected, wp_allow_comment( $comment_data ) ); 104 } 105 106 /** 107 * Data provider. 108 * 109 * @return array[] 110 */ 111 public function data_should_approve_a_pingback_only_when_it_comes_from_this_site() { 112 return array( 113 'a pingback from this site' => array( true, 1 ), 114 'a pingback from another site' => array( false, 0 ), 115 ); 116 } 74 117 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)