forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostClass.php
More file actions
29 lines (24 loc) · 797 Bytes
/
postClass.php
File metadata and controls
29 lines (24 loc) · 797 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
<?php
/**
* @group post
* @covers ::post_class
*/
class Tests_Post_PostClass extends WP_UnitTestCase {
protected $post_id;
public function setUp() {
parent::setUp();
$this->post_id = self::factory()->post->create();
}
public function test_post_class() {
$expected = 'class="' . implode( ' ', get_post_class( '', $this->post_id ) ) . '"';
$this->expectOutputString( $expected );
post_class( '', $this->post_id );
}
public function test_post_class_extra_esc_attr() {
$classes = get_post_class( '', $this->post_id );
$escaped_again = array_map( 'esc_attr', $classes );
$escaped_another_time = 'class="' . esc_attr( implode( ' ', $escaped_again ) ) . '"';
$this->expectOutputString( $escaped_another_time );
post_class( '', $this->post_id );
}
}