@@ -34,29 +34,34 @@ public function extension_data()
34
34
];
35
35
36
36
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 ' , []],
45
49
];
46
50
}
47
51
48
52
/**
49
53
* @dataProvider extension_data
50
54
*/
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 = [])
52
56
{
57
+ $ content = file_get_contents ($ file );
53
58
$ output = new Output ();
54
59
$ exporter = new php_exporter ($ output , '' );
55
- $ exporter ->set_content (explode ("\n" , file_get_contents ( $ content) ));
60
+ $ exporter ->set_content (explode ("\n" , $ content ));
56
61
57
- $ name = $ exporter ->get_event_name ($ line , false );
62
+ $ name = $ exporter ->get_event_name ($ line , $ is_dispatch );
58
63
$ 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 ) : [] ;
60
65
61
66
self ::assertEquals ($ expected_name , $ name );
62
67
self ::assertEquals ($ expected_vars , $ vars );
0 commit comments