$v) $out .= "$k = $v\n"; return $out; } function _shortcode_paragraph( $atts, $content ) { extract(shortcode_atts(array( 'class' => 'graf', ), $atts)); return "

$content

\n"; } function test_the_content() { $post_content = <<This is the excerpt. This is the body. EOF; $post_id = $this->factory->post->create( compact( 'post_content' ) ); $expected = <<This is the excerpt.

This is the body.

EOF; $this->go_to( get_permalink( $post_id ) ); $this->assertTrue( is_single() ); $this->assertTrue( have_posts() ); $this->assertNull( the_post() ); $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); } function test_the_content_shortcode() { $post_content = <<factory->post->create( compact( 'post_content' ) ); $this->go_to( get_permalink( $post_id ) ); $this->assertTrue( is_single() ); $this->assertTrue( have_posts() ); $this->assertNull( the_post() ); $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); } function test_the_content_shortcode_paragraph() { $post_content = <<Graf by itself:

my graf

another graf with whitespace

An

inline graf

, this doesn’t make much sense.

A graf with a single EOL first:

blah

EOF; $post_id = $this->factory->post->create( compact( 'post_content' ) ); $this->go_to( get_permalink( $post_id ) ); $this->assertTrue( is_single() ); $this->assertTrue( have_posts() ); $this->assertNull( the_post() ); $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); } function test_the_content_attribute_filtering() { kses_init_filters(); // http://bpr3.org/?p=87 // the title attribute should make it through unfiltered $post_content = <<Mariat, D., Taourit, S., Guérin, G. (2003). . Genetics Selection Evolution, 35(1), 119-133. DOI: 10.1051/gse:2002039 EOF; $expected = <<Mariat, D., Taourit, S., Guérin, G. (2003). . Genetics Selection Evolution, 35(1), 119-133. DOI: 10.1051/gse:2002039

EOF; $post_id = $this->factory->post->create( compact( 'post_content' ) ); $this->go_to( get_permalink( $post_id ) ); $this->assertTrue( is_single() ); $this->assertTrue( have_posts() ); $this->assertNull( the_post() ); $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); kses_remove_filters(); } function test_the_content_attribute_value_with_colon() { kses_init_filters(); // http://bpr3.org/?p=87 // the title attribute should make it through unfiltered $post_content = <<foo EOF; $expected = <<foo

EOF; $post_id = $this->factory->post->create( compact( 'post_content' ) ); $this->go_to( get_permalink( $post_id ) ); $this->assertTrue( is_single() ); $this->assertTrue( have_posts() ); $this->assertNull( the_post() ); $this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) ); kses_remove_filters(); } }