Changeset 45101
- Timestamp:
- 04/02/2019 10:14:19 PM (5 years ago)
- Location:
- trunk/tests/phpunit/tests/widgets
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets/media-audio-widget.php
r43571 r45101 52 52 53 53 /** 54 * Test get_instance_schema filtering. 55 * 56 * @covers WP_Widget_Media_Audio::get_instance_schema 57 * 58 * @ticket 45029 59 */ 60 function test_get_instance_schema_filtering() { 61 $wp_widget_audio = new WP_Widget_Media_Audio(); 62 $schema = $wp_widget_audio->get_instance_schema(); 63 64 add_filter( 'widget_media_audio_instance_schema', array( $this, 'filter_instance_schema' ), 10, 2 ); 65 $schema = $wp_widget_audio->get_instance_schema(); 66 67 $this->assertTrue( $schema['loop']['default'] ); 68 } 69 70 /** 71 * Filters instance schema. 72 * 73 * @since 5.2.0 74 * 75 * @param array $schema Schema. 76 * @param WP_Widget_Media_Audio $widget Widget. 77 * 78 * @return array 79 */ 80 public function filter_instance_schema( $schema, $widget ) { 81 // Override the default loop value (false). 82 $schema['loop']['default'] = true; 83 return $schema; 84 } 85 86 /** 54 87 * Test constructor. 55 88 * -
trunk/tests/phpunit/tests/widgets/media-image-widget.php
r43571 r45101 35 35 $widget = new WP_Widget_Media_Image(); 36 36 $schema = $widget->get_instance_schema(); 37 38 37 $this->assertEqualSets( 39 38 array( … … 59 58 60 59 /** 60 * Test schema filtering. 61 * 62 * @covers WP_Widget_Media_Image::get_instance_schema 63 * 64 * @ticket 45029 65 */ 66 function test_get_instance_schema_filtering() { 67 $widget = new WP_Widget_Media_Image(); 68 $schema = $widget->get_instance_schema(); 69 70 add_filter( 'widget_media_image_instance_schema', array( $this, 'filter_instance_schema' ), 10, 2 ); 71 $schema = $widget->get_instance_schema(); 72 73 $this->assertSame( 'large', $schema['size']['default'] ); 74 } 75 76 /** 77 * Filters instance schema. 78 * 79 * @since 5.2.0 80 * 81 * @param array $schema Schema. 82 * @param WP_Widget_Media_Image $widget Widget. 83 * 84 * @return array 85 */ 86 public function filter_instance_schema( $schema, $widget ) { 87 // Override the default size value ('medium'). 88 $schema['size']['default'] = 'large'; 89 return $schema; 90 } 91 92 /** 61 93 * Test constructor. 62 94 * -
trunk/tests/phpunit/tests/widgets/media-video-widget.php
r43571 r45101 53 53 54 54 /** 55 * Test schema filtering. 56 * 57 * @covers WP_Widget_Media_Video::get_instance_schema 58 * 59 * @ticket 45029 60 */ 61 function test_get_instance_schema_filtering() { 62 $widget = new WP_Widget_Media_Video(); 63 $schema = $widget->get_instance_schema(); 64 65 add_filter( 'widget_media_video_instance_schema', array( $this, 'filter_instance_schema' ), 10, 2 ); 66 $schema = $widget->get_instance_schema(); 67 68 $this->assertTrue( $schema['loop']['default'] ); 69 } 70 71 /** 72 * Filters instance schema. 73 * 74 * @since 5.2.0 75 * 76 * @param array $schema Schema. 77 * @param WP_Widget_Media_Video $widget Widget. 78 * 79 * @return array 80 */ 81 public function filter_instance_schema( $schema, $widget ) { 82 // Override the default loop value (false). 83 $schema['loop']['default'] = true; 84 return $schema; 85 } 86 87 /** 55 88 * Test constructor. 56 89 *
Note: See TracChangeset
for help on using the changeset viewer.