mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning. This replaces all uses of the following: * `join()` with `implode()` * `sizeof()` with `count()` * `is_writeable()` with `is_writable()` * `doubleval()` with a `(float)` cast In part, this is a follow-up to #47746. Props jrf. See #50767. git-svn-id: https://develop.svn.wordpress.org/trunk@49193 602fd350-edb4-49c9-b593-d223f7449a82
30 lines
797 B
PHP
30 lines
797 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="' . implode( ' ', 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( implode( ' ', $escaped_again ) ) . '"';
|
|
|
|
$this->expectOutputString( $escaped_another_time );
|
|
body_class( '', $this->post_id );
|
|
}
|
|
}
|