1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * @group comment |
---|
5 | */ |
---|
6 | class Tests_Comment_GetCommentAuthorUrl extends WP_UnitTestCase { |
---|
7 | protected static $comments = array(); |
---|
8 | |
---|
9 | public static function wpSetUpBeforeClass( $factory ) { |
---|
10 | unset( $GLOBALS['comment'] ); |
---|
11 | |
---|
12 | $comment_ids = $factory->comment->create_post_comments( 0, 1 ); |
---|
13 | self::$comments = array_map( 'get_comment', $comment_ids ); |
---|
14 | |
---|
15 | } |
---|
16 | |
---|
17 | public function get_comment_author_url_filter( $url, $id, $comment ) { |
---|
18 | $this->assertEquals($id,$comment->comment_ID); |
---|
19 | return $url; |
---|
20 | } |
---|
21 | |
---|
22 | public function test_comment() { |
---|
23 | add_filter( 'get_comment_author_url', array( $this, 'get_comment_author_url_filter' ), 99, 3 ); |
---|
24 | |
---|
25 | $comment = reset( self::$comments ); |
---|
26 | |
---|
27 | get_comment_author_url( $comment ); |
---|
28 | } |
---|
29 | |
---|
30 | } |
---|