mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Additionally, this adds a few tests to test output. Fixes #20009. Props mfields, scribu, azaozz, obenland, dd32, nacin, jrf, jdgrimes, garyj, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48060 602fd350-edb4-49c9-b593-d223f7449a82
30 lines
791 B
PHP
30 lines
791 B
PHP
<?php
|
|
|
|
/**
|
|
* @group post
|
|
* @covers ::body_class
|
|
*/
|
|
class Tests_Post_BodyClass extends WP_UnitTestCase {
|
|
protected $post_id;
|
|
|
|
public function setUp() {
|
|
parent::setUp();
|
|
$this->post_id = self::factory()->post->create();
|
|
}
|
|
|
|
public function test_body_class() {
|
|
$expected = 'class="' . join( ' ', get_body_class( '', $this->post_id ) ) . '"';
|
|
$this->expectOutputString( $expected );
|
|
body_class( '', $this->post_id );
|
|
}
|
|
|
|
public function test_body_class_extra_esc_attr() {
|
|
$classes = get_body_class( '', $this->post_id );
|
|
$escaped_again = array_map( 'esc_attr', $classes );
|
|
$escaped_another_time = 'class="' . esc_attr( join( ' ', $escaped_again ) ) . '"';
|
|
|
|
$this->expectOutputString( $escaped_another_time );
|
|
body_class( '', $this->post_id );
|
|
}
|
|
}
|