Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:ampproject/amp-wp into fix/4525
Browse files Browse the repository at this point in the history
* 'develop' of github.com:ampproject/amp-wp:
  Update tests after block-library/style.css changes in Gutenberg 7.9 (ampproject#4579)
  Restrict doing plugin upgrade routine when not in admin (ampproject#4538)
  • Loading branch information
westonruter committed Apr 14, 2020
2 parents 751c645 + 9e4e491 commit 88e9403
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion includes/amp-helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function amp_init() {
*/
$options = get_option( AMP_Options_Manager::OPTION_NAME, [] );
$old_version = isset( $options['version'] ) ? $options['version'] : '0.0';
if ( AMP__VERSION !== $old_version ) {
if ( AMP__VERSION !== $old_version && is_admin() && current_user_can( 'manage_options' ) ) {
/**
* Triggers when after amp_init when the plugin version has updated.
*
Expand Down
4 changes: 2 additions & 2 deletions tests/php/test-amp-style-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,7 @@ static function() {
'wp_footer',
function() {
?>
<div class="is-style-outline"><button class="wp-block-button__link"></button></div>
<figure class="wp-block-audio"><figcaption></figcaption></figure>
<div class="wp-block-foo"><figcaption></figcaption></div>
<img src="https://example.com/example.jpg" width="100" height="200">
<?php
Expand All @@ -2635,7 +2635,7 @@ function( $original_dom, $original_source, $amphtml_dom, $amphtml_source ) {
$this->assertStringContains( 'admin-bar', $original_dom->body->getAttribute( 'class' ) );
$this->assertStringContains( 'earlyprintstyle', $original_source, 'Expected early print style to not be present.' );

$this->assertStringContains( '.is-style-outline .wp-block-button__link', $amphtml_source, 'Expected block-library/style.css' );
$this->assertStringContains( '.wp-block-audio figcaption', $amphtml_source, 'Expected block-library/style.css' );
$this->assertStringContains( '[class^="wp-block-"]:not(.wp-block-gallery) figcaption', $amphtml_source, 'Expected twentyten/blocks.css' );
$this->assertStringContains( 'amp-img.amp-wp-enforced-sizes', $amphtml_source, 'Expected amp-default.css' );
$this->assertStringContains( 'ab-empty-item', $amphtml_source, 'Expected admin-bar.css to still be present.' );
Expand Down

0 comments on commit 88e9403

Please sign in to comment.