本文整理汇总了PHP中DataProvider::load方法的典型用法代码示例。如果您正苦于以下问题:PHP DataProvider::load方法的具体用法?PHP DataProvider::load怎么用?PHP DataProvider::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataProvider
的用法示例。
在下文中一共展示了DataProvider::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* @return array
*/
protected function getData($provider)
{
if (strpos($provider, '.')) {
$rc = new \ReflectionClass($this);
list($file, $query) = DataProvider::parseAnnotation($provider, $rc->getFileName());
return DataProvider::load($file, $query);
} else {
return $this->{$provider}();
}
}
示例2: loadData
/**
* Loads data according to the file annotation or specified by Tester\Runner\TestHandler::initiateDataProvider()
* @return array
*/
public static function loadData()
{
if (isset($_SERVER['argv'][2])) {
list(, $query, $file) = $_SERVER['argv'];
} else {
$annotations = self::getTestAnnotations();
if (!isset($annotations['dataprovider'])) {
throw new \Exception('Missing annotation @dataProvider.');
}
$provider = (array) $annotations['dataprovider'];
list($file, $query) = DataProvider::parseAnnotation($provider[0], $annotations['file']);
}
$data = DataProvider::load($file, $query);
return reset($data);
}
示例3: loadData
/**
* Loads data according to the file annotation or specified by Tester\Runner\TestHandler::initiateDataProvider()
* @return array
*/
public static function loadData()
{
if (isset($_SERVER['argv']) && ($tmp = preg_filter('#--dataprovider=(.*)#Ai', '$1', $_SERVER['argv']))) {
list($query, $file) = explode('|', reset($tmp), 2);
} else {
$annotations = self::getTestAnnotations();
if (!isset($annotations['dataprovider'])) {
throw new \Exception('Missing annotation @dataProvider.');
}
$provider = (array) $annotations['dataprovider'];
list($file, $query) = DataProvider::parseAnnotation($provider[0], $annotations['file']);
}
$data = DataProvider::load($file, $query);
return reset($data);
}
示例4: getData
/**
* @return array
*/
protected function getData($provider)
{
if (strpos($provider, '.')) {
list($file, $query) = preg_split('#\\s*,?\\s+#', "{$provider} ", 2);
$rc = new \ReflectionClass($this);
return DataProvider::load(dirname($rc->getFileName()) . DIRECTORY_SEPARATOR . $file, $query);
} else {
return $this->{$provider}();
}
}