/** * * Sets data in the global file with the given name and value */ public static function setData($name, $value) { if (KalturaGlobalData::$dataFile == null) { $isInit = KalturaGlobalData::initDataFile(); if (!$isInit) { return null; } } //if (!is_numeric($value)) $value = '"' . $value . '"'; KalturaGlobalData::$dataFile->{$name} = $value; KalturaGlobalData::$dataFile->saveToIniFile(); }
/** * @return array<array> */ protected function provideTestData($className, $methodName) { KalturaLog::debug("class [{$className}], method [{$methodName}]"); $method = new ReflectionMethod($className, $methodName); $args = $method->getParameters(); $methodConfig = $this->config->get($methodName); if ($methodConfig) { KalturaLog::debug("Tests data found for test [{$methodName}]"); } elseif (is_array($args) && count($args)) { $default = new Zend_Config(array(), true); foreach ($args as $index => $arg) { $argConfig = new Zend_Config(array(), true); $argName = $arg->getName(); KalturaLog::info("Create default config for attribute [{$argName}] in method [{$methodName}]"); $objectType = $arg->getClass(); if ($objectType) { $objectType = $objectType->getName(); KalturaLog::info("Default config for attribute [{$argName}] of objectType [{$objectType}]"); $argConfig->objectType = $objectType; } elseif ($arg->isArray()) { KalturaLog::info("Default config for attribute [{$argName}] of objectType [array]"); $argConfig->objectType = 'array'; } else { KalturaLog::info("Default config for attribute [{$argName}] of native objectType"); $argConfig->objectType = 'native'; } $default->{$argName} = $argConfig; } $methodConfig = new Zend_Config(array('test0' => $default), true); $this->config->{$methodName} = $methodConfig; $this->config->saveToIniFile(); } $tests = array(); if ($methodConfig instanceof Zend_Config) { foreach ($methodConfig as $testName => $testConfig) { $test = array(); if (is_array($args) && count($args)) { foreach ($args as $index => $arg) { try { $value = $this->getArgConfig($testConfig, $arg); $test[] = $value; } catch (KalturaTestException $e) { $this->fail($e->getMessage()); } } } $tests[] = $test; } } KalturaLog::info("Tests data provided [" . print_r($tests, true) . "]"); return $tests; }