bobbingwide / oik-libs

Shared Library Repository
https://www.oik-plugins.com/oik-plugins/oik-libs-shared-library-repository/
GNU General Public License v2.0
2 stars 0 forks source link

Update shared library tests for WordPress 4.9 #8

Closed bobbingwide closed 6 years ago

bobbingwide commented 6 years ago

Changes to the way some shortcodes are expanded means we need to adjust the tests for shortcode examples functions: captionexample and embedexample.

At the same time, reconcile shared library files with the changes in oik v3.2.1, 3.2.2 and/or 3.2.3

bobbingwide commented 6 years ago

It seems that the HTML generated for embed__example in one environment is different from that in another. All environments running WordPress 4.9.1.

Environment HTML
qw/wordpress iframe is not wrapped in a span
qw/oikcom iframe is wrapped in a span and iframe src= parameter is different
qw/hm as qw/oikcom

qw/wordpress

<iframe width="480" height="360" 
src="https://www.youtube.com/embed/nH228-XQ-A8?feature=oembed" frameborder="0" gesture="media" allowfullscreen>
</iframe>

qw/oikcom

<span class="embed-youtube" style="text-align:center; display: block;">
<iframe class="youtube-player" type="text/html" width="640" height="390" 
src="https://www.youtube.com/embed/nH228-XQ-A8?version=3&amp;rel=1&amp;fs=1&amp;autohide=2&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1&amp;wmode=transparent" frameborder="0" allowfullscreen="true">
</iframe>
</span>

The extra HTML is due to Jetpack's Shortcode Embeds module. Note: Jetpack was backlevel ( 3.9.x ) on both of these installations. Updating to Jetpack 5.5.1 didn't make any difference. For environment independence the test case should disable the Jetpack logic.

Follow on problem with cached oembed

Having deactivated Shortcode Embeds the iframe tag for qw/hm and qw/oikcom was still different from the original value saved in the test case data generated on qw/wordpres. It included allow="encrypted-media" before allowfullscreen.

The reason that qw/wordpress returned a different iframe tag was due to the fact that the embed request had been cached. An oembed_cache post type record already existed, created 25th November 2017. This was different from the records that have been cached more recently for qw/oikcom and qw/hm. Note: The post_name for each of the cached posts is identical: 82eaa291edeac05b611152d52f64ef2b.

The test case should eliminate any chance of using cached embed output.

bobbingwide commented 6 years ago

Having read https://core.trac.wordpress.org/ticket/34115 it looks like my problem with oembed_cache data being different in other environments is due to the fact that database updates are rolled back for PHPUnit tests. So, until I rerun the embed example from oik options -> Shortcode help the version stored in qw/wordpress will remain unchanged.