@@ -34,29 +34,34 @@ public function extension_data()
3434 ];
3535
3636 return [
37- [27 , './tests/events/invalid_name_long_multi.php ' , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
38- [17 , './tests/events/invalid_name_long_single.php ' , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
39- [27 , './tests/events/invalid_name_short_multi.php ' , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
40- [17 , './tests/events/invalid_name_short_single.php ' , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
41- [27 , './tests/events/valid_name_long_multi.php ' , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
42- [17 , './tests/events/valid_name_long_single.php ' , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
43- [27 , './tests/events/valid_name_short_multi.php ' , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
44- [17 , './tests/events/valid_name_short_single.php ' , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
37+ [27 , './tests/events/invalid_name_long_multi.php ' , false , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
38+ [17 , './tests/events/invalid_name_long_single.php ' , false , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
39+ [27 , './tests/events/invalid_name_short_multi.php ' , false , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
40+ [17 , './tests/events/invalid_name_short_single.php ' , false , 'rxu.PostsMerging.posts_merging_end ' , $ expected_vars , $ expected_errors ],
41+ [7 , './tests/events/invalid_name_simple.php ' , false , 'rxu.PostsMerging.posts_merging_end ' , [], $ expected_errors ],
42+ [7 , './tests/events/invalid_name_simple_dispatch.php ' , true , 'rxu.PostsMerging.posts_merging_end ' , [], $ expected_errors ],
43+ [27 , './tests/events/valid_name_long_multi.php ' , false , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
44+ [17 , './tests/events/valid_name_long_single.php ' , false , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
45+ [27 , './tests/events/valid_name_short_multi.php ' , false , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
46+ [17 , './tests/events/valid_name_short_single.php ' , false , 'rxu.postsmerging.posts_merging_end ' , $ expected_vars ],
47+ [7 , './tests/events/valid_name_simple.php ' , false , 'rxu.postsmerging.posts_merging_end ' , []],
48+ [7 , './tests/events/valid_name_simple_dispatch.php ' , true , 'rxu.postsmerging.posts_merging_end ' , []],
4549 ];
4650 }
4751
4852 /**
4953 * @dataProvider extension_data
5054 */
51- public function test_event_name ($ line , $ content , $ expected_name , $ expected_vars , $ expected_errors = [])
55+ public function test_event_name ($ line , $ file , $ is_dispatch , $ expected_name , $ expected_vars , $ expected_errors = [])
5256 {
57+ $ content = file_get_contents ($ file );
5358 $ output = new Output ();
5459 $ exporter = new php_exporter ($ output , '' );
55- $ exporter ->set_content (explode ("\n" , file_get_contents ( $ content) ));
60+ $ exporter ->set_content (explode ("\n" , $ content ));
5661
57- $ name = $ exporter ->get_event_name ($ line , false );
62+ $ name = $ exporter ->get_event_name ($ line , $ is_dispatch );
5863 $ exporter ->set_current_event ($ name , $ line );
59- $ vars = $ exporter ->get_vars_from_array (false );
64+ $ vars = strpos ( $ content , ' compact( ' ) ? $ exporter ->get_vars_from_array (false ) : [] ;
6065
6166 self ::assertEquals ($ expected_name , $ name );
6267 self ::assertEquals ($ expected_vars , $ vars );
0 commit comments