| | 975 | |
| | 976 | public function data_shortcode_parse_atts() { |
| | 977 | |
| | 978 | return array( |
| | 979 | array( |
| | 980 | '[unittest]', |
| | 981 | '', |
| | 982 | ), |
| | 983 | array( |
| | 984 | '[unitest]Unit Test[/unittest]', |
| | 985 | '', |
| | 986 | ), |
| | 987 | array( |
| | 988 | '[unittest title="unittest" link="https://unit.test/"]', |
| | 989 | array( |
| | 990 | 'title' => 'unittest', |
| | 991 | 'link' => 'https://unit.test/', |
| | 992 | ), |
| | 993 | ), |
| | 994 | array( |
| | 995 | '[unittest title="unittest" link="https://unit.test/"/]', |
| | 996 | array( |
| | 997 | 'title' => 'unittest', |
| | 998 | 'link' => 'https://unit.test/', |
| | 999 | ), |
| | 1000 | ), |
| | 1001 | array( |
| | 1002 | '[unit_test title="unittest" link="https://unit.test/"/]', |
| | 1003 | array( |
| | 1004 | 'title' => 'unittest', |
| | 1005 | 'link' => 'https://unit.test/', |
| | 1006 | ), |
| | 1007 | ), |
| | 1008 | array( |
| | 1009 | '[unit-test title="unittest" link="https://unit.test/"/]', |
| | 1010 | array( |
| | 1011 | 'title' => 'unittest', |
| | 1012 | 'link' => 'https://unit.test/', |
| | 1013 | ), |
| | 1014 | ), |
| | 1015 | array( |
| | 1016 | '[unittest title="unittest" link="https://unit.test/"]Unit Test[/unittest]', |
| | 1017 | array( |
| | 1018 | 'title' => 'unittest', |
| | 1019 | 'link' => 'https://unit.test/', |
| | 1020 | ), |
| | 1021 | ), |
| | 1022 | array( |
| | 1023 | 'title="unittest" link="https://unit.test/"', |
| | 1024 | array( |
| | 1025 | 'title' => 'unittest', |
| | 1026 | 'link' => 'https://unit.test/', |
| | 1027 | ), |
| | 1028 | ), |
| | 1029 | array( |
| | 1030 | '\'\'', |
| | 1031 | array(), |
| | 1032 | ), |
| | 1033 | array( |
| | 1034 | '""', |
| | 1035 | array(), |
| | 1036 | ), |
| | 1037 | ); |
| | 1038 | |
| | 1039 | } |
| | 1040 | |
| | 1041 | /** |
| | 1042 | * @covers ::shortcode_parse_atts |
| | 1043 | * @dataProvider data_shortcode_parse_atts |
| | 1044 | * |
| | 1045 | * @ticket 47863 |
| | 1046 | * |
| | 1047 | * @param $shortcode |
| | 1048 | * @param $expects |
| | 1049 | */ |
| | 1050 | public function test_shortcode_parse_atts( $shortcode, $expects ) { |
| | 1051 | |
| | 1052 | $atts = shortcode_parse_atts( $shortcode ); |
| | 1053 | |
| | 1054 | $this->assertSame( $expects, $atts ); |
| | 1055 | |
| | 1056 | } |