/** * 获取请求适配器 * @return RequestAdapter */ static function getRequestAdapter() { if (is_null(static::$requestAdapter)) { static::$requestAdapter = new RequestAdapter(Mechanic::instance()); } return static::$requestAdapter; }
/** * 处理options * @param $options * @return array */ protected function processOptions(array $options) { $processedOptions = []; foreach ($options as $key => $option) { $processedOptions[$key] = is_array($option) ? $this->processOptions($option) : $this->mechanic->processValue($option); } return $processedOptions; }
function __construct(Mechanic $mechanic) { $this->mechanic = $mechanic; $this->report = $mechanic->getReport(); }
/** * 获取全局参数 * @return ArrayCache */ function getGlobalParameters() { return $this->mechanic->getParameters(); }
/** * 创建测试套件 * @param Mechanic $mechanic * @return array */ protected function createTestSuites(Mechanic $mechanic = null) { //找出所有的php文件 $files = static::getFinder()->files()->name('*.php')->in("{$mechanic->getLibPath()}/TestSuite"); $testSuites = []; foreach ($files as $file) { $testSuiteClass = "{$mechanic->getNamespace()}\\TestSuite\\" . $file->getBasename('.php'); $testSuite = new $testSuiteClass(); $testSuites[] = $testSuite; } return $testSuites; }