forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
33 lines (24 loc) · 946 Bytes
/
template.php
File metadata and controls
33 lines (24 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* @group comment
*/
class Tests_Comment_Template extends WP_UnitTestCase {
function test_get_comments_number() {
$post_id = self::factory()->post->create();
$this->assertEquals( 0, get_comments_number( 0 ) );
$this->assertEquals( 0, get_comments_number( $post_id ) );
$this->assertEquals( 0, get_comments_number( get_post( $post_id ) ) );
self::factory()->comment->create_post_comments( $post_id, 12 );
$this->assertEquals( 12, get_comments_number( $post_id ) );
$this->assertEquals( 12, get_comments_number( get_post( $post_id ) ) );
}
function test_get_comments_number_without_arg() {
$post_id = self::factory()->post->create();
$permalink = get_permalink( $post_id );
$this->go_to( $permalink );
$this->assertEquals( 0, get_comments_number() );
self::factory()->comment->create_post_comments( $post_id, 12 );
$this->go_to( $permalink );
$this->assertEquals( 12, get_comments_number() );
}
}