diff --git a/includes/widgets/class-amp-widget-categories.php b/includes/widgets/class-amp-widget-categories.php index 398c2153809..b5c0442f6e8 100644 --- a/includes/widgets/class-amp-widget-categories.php +++ b/includes/widgets/class-amp-widget-categories.php @@ -38,7 +38,8 @@ public function modify_select( $dropdown ) { */ public function widget( $args, $instance ) { static $first_dropdown = true; - $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories' ); // phpcs:ignore. + // @codingStandardsIgnoreLine + $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories' ); /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $c = ! empty( $instance['count'] ) ? '1' : '0'; @@ -59,7 +60,8 @@ public function widget( $args, $instance ) { $dropdown_id = ( $first_dropdown ) ? 'cat' : "{$this->id_base}-dropdown-{$this->number}"; $first_dropdown = false; echo ''; - $cat_args['show_option_none'] = __( 'Select Category' ); // phpcs:ignore. + // @codingStandardsIgnoreLine + $cat_args['show_option_none'] = __( 'Select Category' ); $cat_args['id'] = $dropdown_id; /** * Filters the arguments for the Categories widget drop-down. diff --git a/tests/test-class-amp-widget-archives.php b/tests/test-class-amp-widget-archives.php index f273c2bc97d..7ba55052f14 100644 --- a/tests/test-class-amp-widget-archives.php +++ b/tests/test-class-amp-widget-archives.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Archives extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-categories.php b/tests/test-class-amp-widget-categories.php index 4efb489cf21..40b1170a4ba 100644 --- a/tests/test-class-amp-widget-categories.php +++ b/tests/test-class-amp-widget-categories.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Categories extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-media-audio.php b/tests/test-class-amp-widget-media-audio.php index 188621563b9..f00d8afb384 100644 --- a/tests/test-class-amp-widget-media-audio.php +++ b/tests/test-class-amp-widget-media-audio.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Media_Audio extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-media-gallery.php b/tests/test-class-amp-widget-media-gallery.php index 6dfa7bcf20c..156f4eb9fb9 100644 --- a/tests/test-class-amp-widget-media-gallery.php +++ b/tests/test-class-amp-widget-media-gallery.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Media_Gallery extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-media-image.php b/tests/test-class-amp-widget-media-image.php index 56014a677f5..00775b3d0c1 100644 --- a/tests/test-class-amp-widget-media-image.php +++ b/tests/test-class-amp-widget-media-image.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Media_Image extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-media-video.php b/tests/test-class-amp-widget-media-video.php index 43a0fe434dc..8f2f802b275 100644 --- a/tests/test-class-amp-widget-media-video.php +++ b/tests/test-class-amp-widget-media-video.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Media_Video extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-recent-comments.php b/tests/test-class-amp-widget-recent-comments.php index 0b9ba0dba8e..0112078f07e 100644 --- a/tests/test-class-amp-widget-recent-comments.php +++ b/tests/test-class-amp-widget-recent-comments.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_Recent_Comments extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widget-rss.php b/tests/test-class-amp-widget-rss.php index f6e216cce9d..d8bdd9b3878 100644 --- a/tests/test-class-amp-widget-rss.php +++ b/tests/test-class-amp-widget-rss.php @@ -26,6 +26,7 @@ class Test_AMP_Widget_RSS extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); AMP_Theme_Support::init(); $amp_widgets = new AMP_Widgets(); $amp_widgets->register_widgets(); diff --git a/tests/test-class-amp-widgets.php b/tests/test-class-amp-widgets.php index 44fc074b11f..0e0b071e0ca 100644 --- a/tests/test-class-amp-widgets.php +++ b/tests/test-class-amp-widgets.php @@ -23,6 +23,7 @@ class Test_AMP_Widgets extends WP_UnitTestCase { */ public function setUp() { parent::setUp(); + wp_maybe_load_widgets(); $this->instance = new AMP_Widgets(); } @@ -34,7 +35,6 @@ public function setUp() { public function test_init() { $this->instance->init(); $this->assertEquals( 10, has_filter( 'widgets_init', array( $this->instance, 'register_widgets' ) ) ); - $this->assertEquals( 10, has_filter( 'show_recent_comments_widget_style', '__return_false' ) ); } /**