Add a return value to wp_register_script() and wp_register_style() which matches the return value of WP_Dependencies::add().

Props katzwebdesign, pareshradadiya, DrewAPicture.

Fixes #31126


git-svn-id: https://develop.svn.wordpress.org/trunk@32483 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2015-05-10 19:56:15 +00:00
parent 099c066e24
commit 39639c79da
5 changed files with 30 additions and 3 deletions
@@ -155,4 +155,15 @@ class Tests_Dependencies_Scripts extends WP_UnitTestCase {
// No scripts left to print
$this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
}
/**
* Testing 'wp_register_script' return boolean success/failure value.
*
* @ticket 31126
*/
function test_wp_register_script() {
$this->assertTrue( wp_register_script( 'duplicate-handler', 'http://example.com' ) );
$this->assertFalse( wp_register_script( 'duplicate-handler', 'http://example.com' ) );
}
}
@@ -229,4 +229,14 @@ CSS;
$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
}
/**
* Testing 'wp_register_style' return boolean success/failure value.
*
* @ticket 31126
*/
function test_wp_register_style(){
$this->assertTrue( wp_register_style( 'duplicate-handler', 'http://example.com' ) );
$this->assertFalse( wp_register_style( 'duplicate-handler', 'http://example.com' ) );
}
}