Skip to content

Commit 039ef47

Browse files
committed
Fix builds after Gutenberg merged into core
1 parent 9ddac9e commit 039ef47

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

dev-lib

tests/validation/test-class-amp-validation-manager.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,11 +929,21 @@ public function test_decorate_shortcode_and_filter_source() {
929929

930930
$source_json = '{"hook":"the_content","filter":true,"sources":[{"type":"core","name":"wp-includes","function":"WP_Embed::run_shortcode"},{"type":"core","name":"wp-includes","function":"WP_Embed::autoembed"}';
931931
if ( 9 === has_filter( 'the_content', 'do_blocks' ) ) {
932-
$source_json .= ',{"type":"plugin","name":"gutenberg","function":"gutenberg_wpautop"},{"type":"plugin","name":"amp","function":"AMP_Validation_Manager::add_block_source_comments"},{"type":"plugin","name":"gutenberg","function":"do_blocks"},{"type":"core","name":"wp-includes","function":"wptexturize"},{"type":"core","name":"wp-includes","function":"shortcode_unautop"}';
933-
} else {
934-
$source_json .= ',{"type":"core","name":"wp-includes","function":"wptexturize"},{"type":"core","name":"wp-includes","function":"wpautop"},{"type":"core","name":"wp-includes","function":"shortcode_unautop"}';
932+
if ( function_exists( 'gutenberg_wpautop' ) ) {
933+
$source_json .= ',{"type":"plugin","name":"gutenberg","function":"gutenberg_wpautop"}';
934+
}
935+
$source_json .= ',{"type":"plugin","name":"amp","function":"AMP_Validation_Manager::add_block_source_comments"}';
936+
$source_json .= sprintf(
937+
',{"type":"%s","name":"%s","function":"do_blocks"}',
938+
function_exists( 'gutenberg_wpautop' ) ? 'plugin' : 'core',
939+
function_exists( 'gutenberg_wpautop' ) ? 'gutenberg' : 'wp-includes'
940+
);
941+
}
942+
$source_json .= ',{"type":"core","name":"wp-includes","function":"wptexturize"}';
943+
if ( ! function_exists( 'gutenberg_wpautop' ) ) {
944+
$source_json .= ',{"type":"core","name":"wp-includes","function":"wpautop"}';
935945
}
936-
$source_json .= ',{"type":"core","name":"wp-includes","function":"prepend_attachment"},{"type":"core","name":"wp-includes","function":"wp_make_content_images_responsive"},{"type":"core","name":"wp-includes","function":"capital_P_dangit"},{"type":"core","name":"wp-includes","function":"do_shortcode"},{"type":"core","name":"wp-includes","function":"convert_smilies"}]}';
946+
$source_json .= ',{"type":"core","name":"wp-includes","function":"shortcode_unautop"},{"type":"core","name":"wp-includes","function":"prepend_attachment"},{"type":"core","name":"wp-includes","function":"wp_make_content_images_responsive"},{"type":"core","name":"wp-includes","function":"capital_P_dangit"},{"type":"core","name":"wp-includes","function":"do_shortcode"},{"type":"core","name":"wp-includes","function":"convert_smilies"}]}';
937947

938948
$expected_content = implode( '', array(
939949
"<!--amp-source-stack $source_json-->",

0 commit comments

Comments
 (0)