forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincludesComment.php
More file actions
83 lines (73 loc) · 1.93 KB
/
includesComment.php
File metadata and controls
83 lines (73 loc) · 1.93 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @group admin
* @group comment
*/
class Tests_Admin_IncludesComment extends WP_UnitTestCase {
/**
* Post ID to add comments to.
*
* @var int
*/
public static $post_id;
/**
* Comment IDs.
*
* @var array
*/
public static $comment_ids = array();
/**
* Create the post and comments for the tests.
*
* @param WP_UnitTest_Factory $factory
*/
public static function wpSetUpBeforeClass( $factory ) {
self::$post_id = $factory->post->create();
self::$comment_ids[] = $factory->comment->create(
array(
'comment_author' => 1,
'comment_date' => '2014-05-06 12:00:00',
'comment_date_gmt' => '2014-05-06 07:00:00',
'comment_post_ID' => self::$post_id,
)
);
self::$comment_ids[] = $factory->comment->create(
array(
'comment_author' => 2,
'comment_date' => '2004-01-02 12:00:00',
'comment_post_ID' => self::$post_id,
)
);
}
/**
* Verify that both the comment date and author must match for a comment to exist.
*/
public function test_must_match_date_and_author() {
$this->assertNull( comment_exists( 1, '2004-01-02 12:00:00' ) );
$this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00' ) );
}
/**
* @ticket 33871
*/
public function test_default_value_of_timezone_should_be_blog() {
$this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00' ) );
}
/**
* @ticket 33871
*/
public function test_should_respect_timezone_blog() {
$this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00', 'blog' ) );
}
/**
* @ticket 33871
*/
public function test_should_respect_timezone_gmt() {
$this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 07:00:00', 'gmt' ) );
}
/**
* @ticket 33871
*/
public function test_invalid_timezone_should_fall_back_on_blog() {
$this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00', 'not_a_valid_value' ) );
}
}