/** * Cleans up the environment after running a test. */ protected function tearDown() { $this->kFileTransferMgr = null; parent::tearDown(); }
/** * * Creates a new Kaltura API Test Case * @param unknown_type $name * @param array $data * @param unknown_type $dataName */ public function __construct($name = NULL, array $data = array(), $dataName = '') { KalturaLog::debug("KalturaApiTestCase::__construct name [{$name}], data [" . print_r($data, true) . "], dataName [{$dataName}]\n"); parent::__construct($name, $data, $dataName); $testConfig = $this->config->get('config'); $needSave = false; //TODO: add support for getting the values from the global data if (!$testConfig->serviceUrl) { $testConfig->serviceUrl = '@SERVICE_URL@'; $needSave = true; } if (!$testConfig->partnerId) { $testConfig->partnerId = "@TEST_PARTNER_ID@"; $needSave = true; } if (!$testConfig->clientTag) { $testConfig->clientTag = 'unitTest'; $needSave = true; } if (!$testConfig->curlTimeout) { $testConfig->curlTimeout = 90; $needSave = true; } if (!isset($testConfig->startSession)) { $testConfig->startSession = false; $needSave = true; } if ($testConfig->startSession) { if (!$testConfig->secret) { $testConfig->secret = 'PARTNER_SECRET'; $needSave = true; } if (!$testConfig->userSecret) { $testConfig->secret = 'PARTNER_USER_SECRET'; $needSave = true; } if (!$testConfig->userId) { $testConfig->userId = ''; } if (!$testConfig->sessionType) { $testConfig->sessionType = 2; $needSave = true; } if (!$testConfig->expiry) { $testConfig->expiry = 60 * 60 * 24; $needSave = true; } if (!$testConfig->privileges) { $testConfig->privileges = ''; } } if ($needSave) { $this->config->saveToIniFile(); } $kalturaConfiguration = new KalturaConfiguration($testConfig->partnerId); $kalturaConfiguration->serviceUrl = $testConfig->serviceUrl; $kalturaConfiguration->clientTag = $testConfig->clientTag; $kalturaConfiguration->curlTimeout = $testConfig->curlTimeout; $kalturaConfiguration->setLogger($this); $this->client = new KalturaClient($kalturaConfiguration); if ($testConfig->startSession) { $this->startSession($this->client, $testConfig->sessionType, $testConfig->userId); } if ($testConfig->serviceUrlStaging) { $kalturaConfigurationStaging = $kalturaConfiguration; $kalturaConfigurationStaging->serviceUrl = $testConfig->serviceUrlStaging; $this->clientStaging = new KalturaClient($kalturaConfigurationStaging); if ($testConfig->startSession) { $this->startSession($this->clientStaging, $testConfig->sessionType, $testConfig->userId); } } }