Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active August 15, 2019 06:13
Show Gist options
  • Save dotherightthing/debaa6196e1f5258b544ace1a6c484de to your computer and use it in GitHub Desktop.
Save dotherightthing/debaa6196e1f5258b544ace1a6c484de to your computer and use it in GitHub Desktop.
[Test custom shortcode] #wordpress

Test custom shortcode

/**
* Test shortcodes
* trim() removes line break added by WordPress
*/
public function test_placeholder() {
$this->go_to(
get_post_permalink( $this->post_id_1 )
);
// $content = get_the_content(); // Trying to get property of non-object
$content = get_post_field('post_content', $this->post_id_1);
$this->assertEqualHtml(
trim( do_shortcode( $content ) ),
'<div class="stack stack_link_viewer gallery-viewer h2-viewer" id="[]-viewer" data-has-image="false" data-expanded="false">
<div class="gallery-viewer--header">
<h2>Heading</h2>
</div>
<div class="stack--wrapper" style="">
<figure class="stack--liner">
<div class="img-wrapper">
<img src="" alt="">
</div>
<iframe width="100%" height="100%" src="" frameborder="0" allowfullscreen="true" scrolling="no" aria-hidden="true"></iframe>
<figcaption class="gallery-viewer--footer">
<div class="gallery-viewer--caption"></div>
</figcaption>
</figure>
</div>
</div>',
'wpdtrt_gallery_shortcode does not return the correct HTML'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment