Skip to content

Commit

Permalink
Ensure global post is set for test_decorate_shortcode_and_filter_source
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Nov 20, 2020
1 parent a418cc9 commit e9348a1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/php/validation/test-class-amp-validation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,11 @@ public function test_has_parameters_passed_by_reference() {
* @throws Exception If assertion fails.
*/
public function test_decorate_shortcode_and_filter_source() {
global $post;
if ( empty( $post ) ) {
$post = self::factory()->post->create_and_get();
}

AMP_Validation_Manager::add_validation_error_sourcing();
$shortcode_fallback = static function() {
return '<b>test</b>';
Expand Down Expand Up @@ -1875,9 +1880,11 @@ public function test_decorate_shortcode_and_filter_source() {

$source_json = wp_json_encode(
[
'hook' => 'the_content',
'filter' => true,
'sources' => $sources,
'hook' => 'the_content',
'filter' => true,
'post_id' => get_the_ID(),
'post_type' => get_post_type(),
'sources' => $sources,
]
);

Expand Down

0 comments on commit e9348a1

Please sign in to comment.