Changeset 52010 for trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php
r51569 r52010 20 20 * @global WP_Styles $wp_styles 21 21 */ 22 function clean_up_global_scope() {22 public function clean_up_global_scope() { 23 23 global $wp_scripts, $wp_styles; 24 24 parent::clean_up_global_scope(); … … 36 36 * @return PHPUnit_Framework_MockObject_MockObject|WP_Widget_Media Mocked instance. 37 37 */ 38 function get_mocked_class_instance( $id_base = 'mocked', $name = 'Mocked', $widget_options = array(), $control_options = array() ) {38 private function get_mocked_class_instance( $id_base = 'mocked', $name = 'Mocked', $widget_options = array(), $control_options = array() ) { 39 39 $original_class_name = 'WP_Widget_Media'; 40 40 $arguments = array( $id_base, $name, $widget_options, $control_options ); … … 54 54 * @covers WP_Widget_Media::_register 55 55 */ 56 function test_constructor() {56 public function test_constructor() { 57 57 $widget = $this->get_mocked_class_instance(); 58 58 $widget->_register(); … … 114 114 * @covers WP_Widget_Media::_register 115 115 */ 116 function test_constructor_in_customize_preview() {116 public function test_constructor_in_customize_preview() { 117 117 global $wp_customize; 118 118 wp_set_current_user( … … 142 142 * @requires function imagejpeg 143 143 */ 144 function test_is_attachment_with_mime_type() {144 public function test_is_attachment_with_mime_type() { 145 145 146 146 $test_image = get_temp_dir() . 'canola.jpg'; … … 171 171 * @covers WP_Widget_Media::sanitize_token_list 172 172 */ 173 function test_sanitize_token_list_string() {173 public function test_sanitize_token_list_string() { 174 174 $widget = $this->get_mocked_class_instance(); 175 175 … … 208 208 * @covers WP_Widget_Media::get_instance_schema 209 209 */ 210 function test_get_instance_schema() {210 public function test_get_instance_schema() { 211 211 $widget = $this->get_mocked_class_instance(); 212 212 $schema = $widget->get_instance_schema(); … … 236 236 * @covers WP_Widget_Media::update 237 237 */ 238 function test_update() {238 public function test_update() { 239 239 $widget = $this->get_mocked_class_instance(); 240 240 $instance = array(); … … 297 297 $this->assertSame( $result, $instance ); 298 298 299 add_filter( 'sanitize_text_field', array( $this, ' _return_wp_error' ) );299 add_filter( 'sanitize_text_field', array( $this, 'return_wp_error' ) ); 300 300 $result = $widget->update( 301 301 array( … … 304 304 $instance 305 305 ); 306 remove_filter( 'sanitize_text_field', array( $this, ' _return_wp_error' ) );306 remove_filter( 'sanitize_text_field', array( $this, 'return_wp_error' ) ); 307 307 $this->assertSame( $result, $instance ); 308 308 } … … 313 313 * @return \WP_Error 314 314 */ 315 function _return_wp_error() {315 public function return_wp_error() { 316 316 return new WP_Error( 'some-error', 'This is not valid!' ); 317 317 } … … 323 323 * @covers WP_Widget_Media::render_media 324 324 */ 325 function test_widget() {325 public function test_widget() { 326 326 $args = array( 327 327 'before_title' => '<h2>', … … 387 387 * @return array Instance. 388 388 */ 389 function filter_widget_mocked_instance( $instance, $args, $object ) {389 public function filter_widget_mocked_instance( $instance, $args, $object ) { 390 390 $this->widget_instance_filter_args = func_get_args(); 391 391 return $instance; … … 397 397 * @covers WP_Widget_Media::form 398 398 */ 399 function test_form() {399 public function test_form() { 400 400 $widget = $this->get_mocked_class_instance(); 401 401 … … 414 414 * @covers WP_Widget_Media::display_media_state 415 415 */ 416 function test_display_media_state() {416 public function test_display_media_state() { 417 417 $widget = $this->get_mocked_class_instance(); 418 418 $attachment_id = self::factory()->attachment->create_object( … … 456 456 * @covers WP_Widget_Media::enqueue_admin_scripts 457 457 */ 458 function test_enqueue_admin_scripts() {458 public function test_enqueue_admin_scripts() { 459 459 set_current_screen( 'widgets.php' ); 460 460 $widget = $this->get_mocked_class_instance(); … … 469 469 * @covers WP_Widget_Media::render_control_template_scripts 470 470 */ 471 function test_render_control_template_scripts() {471 public function test_render_control_template_scripts() { 472 472 $widget = $this->get_mocked_class_instance(); 473 473 … … 484 484 * @covers WP_Widget_Media::has_content 485 485 */ 486 function test_has_content() {486 public function test_has_content() { 487 487 $attachment_id = self::factory()->attachment->create_object( 488 488 array(
Note: See TracChangeset
for help on using the changeset viewer.