File tree Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Original file line number Diff line number Diff line change 16
16
class DataProvider
17
17
{
18
18
19
- /**
20
- * Loads data according to the file annotation or specified by Tester\Runner\TestHandler::initiateDataProvider()
21
- * @return array
22
- */
23
- public static function loadCurrent ()
24
- {
25
- if (isset ($ _SERVER ['argv ' ][2 ])) {
26
- list (, $ query , $ file ) = $ _SERVER ['argv ' ];
27
-
28
- } else {
29
- $ annotations = Environment::getTestAnnotations ();
30
- if (!isset ($ annotations ['dataprovider ' ])) {
31
- throw new \Exception ('Missing annotation @dataProvider. ' );
32
- }
33
- $ provider = (array ) $ annotations ['dataprovider ' ];
34
- list ($ file , $ query ) = self ::parseAnnotation ($ provider [0 ], $ annotations ['file ' ]);
35
- }
36
- $ data = self ::load ($ file , $ query );
37
- return reset ($ data );
38
- }
39
-
40
-
41
19
public static function load ($ file , $ query = NULL )
42
20
{
43
21
if (!is_file ($ file )) {
Original file line number Diff line number Diff line change @@ -137,4 +137,26 @@ public static function getTestAnnotations()
137
137
return Helpers::parseDocComment (file_get_contents ($ file )) + array ('file ' => $ file );
138
138
}
139
139
140
+
141
+ /**
142
+ * Loads data according to the file annotation or specified by Tester\Runner\TestHandler::initiateDataProvider()
143
+ * @return array
144
+ */
145
+ public static function loadData ()
146
+ {
147
+ if (isset ($ _SERVER ['argv ' ][2 ])) {
148
+ list (, $ query , $ file ) = $ _SERVER ['argv ' ];
149
+
150
+ } else {
151
+ $ annotations = self ::getTestAnnotations ();
152
+ if (!isset ($ annotations ['dataprovider ' ])) {
153
+ throw new \Exception ('Missing annotation @dataProvider. ' );
154
+ }
155
+ $ provider = (array ) $ annotations ['dataprovider ' ];
156
+ list ($ file , $ query ) = DataProvider::parseAnnotation ($ provider [0 ], $ annotations ['file ' ]);
157
+ }
158
+ $ data = DataProvider::load ($ file , $ query );
159
+ return reset ($ data );
160
+ }
161
+
140
162
}
You can’t perform that action at this time.
0 commit comments