Add some more data for Shortcode unit tests.

Props miqrogroove.
Fixes #33455.


git-svn-id: https://develop.svn.wordpress.org/trunk@33740 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-08-25 21:50:55 +00:00
parent 4a622d21fb
commit a0a351a75d
1 changed files with 29 additions and 1 deletions

View File

@ -4,7 +4,7 @@
*/
class Tests_Shortcode extends WP_UnitTestCase {
protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar' );
protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar', 'url' );
function setUp() {
parent::setUp();
@ -73,6 +73,10 @@ class Tests_Shortcode extends WP_UnitTestCase {
return __FUNCTION__;
}
function _shortcode_url() {
return 'http://www.wordpress.org/';
}
function test_noatts() {
do_shortcode('[test-shortcode-tag /]');
$this->assertEquals( '', $this->atts );
@ -454,6 +458,30 @@ EOF;
'[gallery]<div>Hello</div>[/gallery]',
'',
),
array(
'[url]',
'http://www.wordpress.org/',
),
array(
'<a href="[url]">',
'<a href="http://www.wordpress.org/">',
),
array(
'<a href=[url] >',
'<a href=http://www.wordpress.org/ >',
),
array(
'<a href="[url]plugins/">',
'<a href="http://www.wordpress.org/plugins/">',
),
array(
'<a href="bad[url]">',
'<a href="//www.wordpress.org/">',
),
array(
'<a onclick="bad[url]">',
'<a onclick="bad[url]">',
),
);
}