예제 #1
0
 /**
  * 获取请求适配器
  * @return RequestAdapter
  */
 static function getRequestAdapter()
 {
     if (is_null(static::$requestAdapter)) {
         static::$requestAdapter = new RequestAdapter(Mechanic::instance());
     }
     return static::$requestAdapter;
 }
예제 #2
0
 /**
  * 处理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;
 }
예제 #3
0
 function __construct(Mechanic $mechanic)
 {
     $this->mechanic = $mechanic;
     $this->report = $mechanic->getReport();
 }
예제 #4
0
 /**
  * 获取全局参数
  * @return ArrayCache
  */
 function getGlobalParameters()
 {
     return $this->mechanic->getParameters();
 }
예제 #5
0
 /**
  * 创建测试套件
  * @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;
 }