[wp-trac] [WordPress Trac] #38796: Customize media control button labels should automatically reflect the specified mime type
WordPress Trac
noreply at wordpress.org
Sat Apr 1 21:21:23 UTC 2017
#38796: Customize media control button labels should automatically reflect the
specified mime type
------------------------------+------------------
Reporter: celloexpressions | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.8
Component: Customize | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
------------------------------+------------------
Changes (by Christian1012):
* keywords: needs-patch => has-patch
Comment:
Added
[https://core.trac.wordpress.org/attachment/ticket/38796/38796.0.diff,
38796.0.diff].
I don't have tests setup locally for trunk, plus I noticed that tests for
`WP_Customize_Control` are still `todo`s. I could write tests but would
need a little help on where to put them. Plus I didn't want to write too
many until I got feedback on the first pass.
{{{#!php
/**
* Test WP_Customize_Media_Control::get_default_button_labels() when mime
type is 'video'.
*
* @see WP_Customize_Media_Control::get_default_button_labels()
*/
public function test_get_default_button_labels_with_video_mime_type() {
// Decalare expectations.
$expected = array(
'select' => 'Select Video',
'change' => 'Change Video',
'default' => 'Default',
'remove' => 'Remove',
'placeholder' => 'No video selected',
'frame_title' => 'Select Video',
'frame_button' => 'Choose Video',
);
// Act.
// Assumes TestCase container has wp_customize property, instance
of WP_Customize_Manager.
// See /trunk/tests/phpunit/tests/customize/control.php for
example that this is based on.
do_action( 'customize_register', $this->wp_customize );
$control = new WP_Customize_Media_Control( $this->wp_customize,
'nosetting', array(
'settings' => array( 'nosetting' ),
'mime_type' => 'video',
) );
// Unit.
$this->assertEquals( $expected,
$control->get_default_button_labels() );
// Functional.
$this->assertEquals( $expected, $control->button_labels );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38796#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list