/** * 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); }
/** * @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}(); } }
/** * 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); }