Skip to content

Commit f481609

Browse files
committed
DataProvider::loadCurrent() moved to Environment::loadData()
1 parent 6f76f9f commit f481609

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

Tester/Framework/DataProvider.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,6 @@
1616
class DataProvider
1717
{
1818

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-
4119
public static function load($file, $query = NULL)
4220
{
4321
if (!is_file($file)) {

Tester/Framework/Environment.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,26 @@ public static function getTestAnnotations()
137137
return Helpers::parseDocComment(file_get_contents($file)) + array('file' => $file);
138138
}
139139

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+
140162
}

0 commit comments

Comments
 (0)