diff --git a/includes/widgets/class-amp-widget-rss.php b/includes/widgets/class-amp-widget-rss.php
index 483c22b4d96..c29399b6486 100644
--- a/includes/widgets/class-amp-widget-rss.php
+++ b/includes/widgets/class-amp-widget-rss.php
@@ -20,7 +20,7 @@ class AMP_Widget_RSS extends WP_Widget_RSS {
* @return void.
*/
public function widget( $args, $instance ) {
- if ( is_amp_endpoint() ) {
+ if ( ! is_amp_endpoint() ) {
parent::widget( $args, $instance );
return;
}
diff --git a/tests/test-class-amp-widget-archives.php b/tests/test-class-amp-widget-archives.php
index c90e834fe01..b741b04e643 100644
--- a/tests/test-class-amp-widget-archives.php
+++ b/tests/test-class-amp-widget-archives.php
@@ -19,6 +19,7 @@ class Test_AMP_Widget_Archives extends WP_UnitTestCase {
*/
public function setUp() {
parent::setUp();
+ add_theme_support( 'amp' );
wp_maybe_load_widgets();
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-categories.php b/tests/test-class-amp-widget-categories.php
index 9c73ce6e553..61e149ddb68 100644
--- a/tests/test-class-amp-widget-categories.php
+++ b/tests/test-class-amp-widget-categories.php
@@ -19,6 +19,7 @@ class Test_AMP_Widget_Categories extends WP_UnitTestCase {
*/
public function setUp() {
parent::setUp();
+ add_theme_support( 'amp ' );
wp_maybe_load_widgets();
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-media-audio.php b/tests/test-class-amp-widget-media-audio.php
index c66aee65a05..3e371d7f5fc 100644
--- a/tests/test-class-amp-widget-media-audio.php
+++ b/tests/test-class-amp-widget-media-audio.php
@@ -23,6 +23,7 @@ public function setUp() {
$this->markTestSkipped( sprintf( 'The widget %s is not present, so neither is its child class.', $wp_widget ) );
}
parent::setUp();
+ add_theme_support( 'amp' );
wp_maybe_load_widgets();
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-media-gallery.php b/tests/test-class-amp-widget-media-gallery.php
index e769d10b8ff..0df8fc4b7bb 100644
--- a/tests/test-class-amp-widget-media-gallery.php
+++ b/tests/test-class-amp-widget-media-gallery.php
@@ -23,6 +23,7 @@ public function setUp() {
$this->markTestSkipped( sprintf( 'The widget %s is not present, so neither is its child class.', $wp_widget ) );
}
parent::setUp();
+ add_theme_support( 'amp' );
wp_maybe_load_widgets();
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-media-image.php b/tests/test-class-amp-widget-media-image.php
index ab36dd476eb..96ed71785ed 100644
--- a/tests/test-class-amp-widget-media-image.php
+++ b/tests/test-class-amp-widget-media-image.php
@@ -23,6 +23,7 @@ public function setUp() {
$this->markTestSkipped( sprintf( 'The widget %s is not present, so neither is its child class.', $wp_widget ) );
}
parent::setUp();
+ add_theme_support( 'amp' );
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-media-video.php b/tests/test-class-amp-widget-media-video.php
index 79690c43250..35ec3e3f207 100644
--- a/tests/test-class-amp-widget-media-video.php
+++ b/tests/test-class-amp-widget-media-video.php
@@ -23,6 +23,7 @@ public function setUp() {
$this->markTestSkipped( sprintf( 'The widget %s is not present, so neither is its child class.', $wp_widget ) );
}
parent::setUp();
+ add_theme_support( 'amp' );
AMP_Theme_Support::init();
}
diff --git a/tests/test-class-amp-widget-recent-comments.php b/tests/test-class-amp-widget-recent-comments.php
index 5dbf581c541..9045a26acad 100644
--- a/tests/test-class-amp-widget-recent-comments.php
+++ b/tests/test-class-amp-widget-recent-comments.php
@@ -12,6 +12,16 @@
*/
class Test_AMP_Widget_Recent_Comments extends WP_UnitTestCase {
+ /**
+ * Setup.
+ *
+ * @inheritdoc
+ */
+ public function setUp() {
+ parent::setUp();
+ add_theme_support( 'amp' );
+ }
+
/**
* Test construct().
*
diff --git a/tests/test-class-amp-widget-rss.php b/tests/test-class-amp-widget-rss.php
index 99d56db1abf..3e38a2beada 100644
--- a/tests/test-class-amp-widget-rss.php
+++ b/tests/test-class-amp-widget-rss.php
@@ -12,6 +12,18 @@
*/
class Test_AMP_Widget_RSS extends WP_UnitTestCase {
+ /**
+ * Setup.
+ *
+ * @inheritdoc
+ */
+ public function setUp() {
+ parent::setUp();
+ add_theme_support( 'amp' );
+ wp_maybe_load_widgets();
+ AMP_Theme_Support::init();
+ }
+
/**
* Test construct().
*
@@ -54,7 +66,7 @@ public function test_widget() {
$widget->widget( $args, $instance );
$output = ob_get_clean();
- $this->assertFalse( strpos( $output, 'assertNotContains( 'assertContains( '