/** * @covers GVCommon::has_gravityview_shortcode() */ function test_has_gravityview_shortcode() { $post_without_shortcode = $this->factory->post->create_and_get(array('post_content' => '[gravityview is not a shortcode')); $post_with_shortcode = $this->factory->post->create_and_get(array('post_content' => '[gravityview]')); $gravityview_post = $this->factory->view->create_and_get(); $this->assertTrue(GVCommon::has_gravityview_shortcode($gravityview_post)); $this->assertTrue(GVCommon::has_gravityview_shortcode($post_with_shortcode)); $this->assertFalse(GVCommon::has_gravityview_shortcode($post_without_shortcode)); }
/** * Check whether the post is GravityView * * - Check post type. Is it `gravityview`? * - Check shortcode * * @param WP_Post $post WordPress post object * @return boolean True: yep, GravityView; No: not! */ function has_gravityview_shortcode($post = NULL) { return GVCommon::has_gravityview_shortcode($post); }