本文整理匯總了PHP中DataProvider::parseAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataProvider::parseAnnotation方法的具體用法?PHP DataProvider::parseAnnotation怎麽用?PHP DataProvider::parseAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataProvider
的用法示例。
在下文中一共展示了DataProvider::parseAnnotation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: 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}();
}
}
示例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'][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);
}