Skip to content

Instantly share code, notes, and snippets.

@JohnDeeBDD
Last active October 31, 2017 19:36
Show Gist options
  • Save JohnDeeBDD/4ce8330e70ad918bb5ab446c388bd27b to your computer and use it in GitHub Desktop.
Save JohnDeeBDD/4ce8330e70ad918bb5ab446c388bd27b to your computer and use it in GitHub Desktop.
This is part of a tutorial on WordPress related Behavior Driven Development (BDD). The full tutorial can be found at: https://wordpress-bdd.com/your-first-test/
<?php
class ShortcodeHelloWorldTest extends \Codeception\TestCase\WPTestCase{
/**
* @test
* it should render the shortcode
*/
public function it_should_render_the_shortcode(){
// GIVEN / ARRANGE
$shortCode = "[first-testable-shortcode]";
// WHEN / ACT
$returnedContent = do_shortcode($shortCode);
// THEN / ASSERT
$this->assertContains("Hello World!", $returnedContent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment