/** * @covers WindowsAzure\MediaServices\Models\TaskHistoricalEvent::getCode */ public function testGetCode() { // Setup $options = array('Code' => 654); $histEvent = TaskHistoricalEvent::createFromOptions($options); // Test $result = $histEvent->getCode(); // Assert $this->assertEquals($options['Code'], $result); }
/** * Fill task from array * * @param array $options Array containing values for object properties * * @return none */ public function fromArray($options) { if (isset($options['Id'])) { Validate::isString($options['Id'], 'options[Id]'); $this->_id = $options['Id']; } if (isset($options['Configuration'])) { Validate::isString($options['Configuration'], 'options[Configuration]'); $this->_configuration = $options['Configuration']; } if (isset($options['EndTime'])) { Validate::isDateString($options['EndTime'], 'options[EndTime]'); $this->_endTime = new \DateTime($options['EndTime']); } if (isset($options['MediaProcessorId'])) { Validate::isString($options['MediaProcessorId'], 'options[MediaProcessorId]'); $this->_mediaProcessorId = $options['MediaProcessorId']; } if (isset($options['Name'])) { Validate::isString($options['Name'], 'options[Name]'); $this->_name = $options['Name']; } if (isset($options['PerfMessage'])) { Validate::isString($options['PerfMessage'], 'options[PerfMessage]'); $this->_perfMessage = $options['PerfMessage']; } if (isset($options['Priority'])) { Validate::isInteger($options['Priority'], 'options[Priority]'); $this->_priority = $options['Priority']; } if (isset($options['Progress'])) { Validate::isDouble($options['Progress'], 'options[Progress]'); $this->_progress = $options['Progress']; } if (isset($options['RunningDuration'])) { Validate::isDouble($options['RunningDuration'], 'options[RunningDuration]'); $this->_runningDuration = $options['RunningDuration']; } if (isset($options['StartTime'])) { Validate::isDateString($options['StartTime'], 'options[StartTime]'); $this->_startTime = new \DateTime($options['StartTime']); } if (isset($options['State'])) { Validate::isInteger($options['State'], 'options[State]'); $this->_state = $options['State']; } if (isset($options['TaskBody'])) { Validate::isString($options['TaskBody'], 'options[TaskBody]'); $this->_taskBody = $options['TaskBody']; } if (isset($options['Options'])) { Validate::isInteger($options['Options'], 'options[Options]'); $this->_options = $options['Options']; } if (isset($options['EncryptionKeyId'])) { Validate::isString($options['EncryptionKeyId'], 'options[EncryptionKeyId]'); $this->_encryptionKeyId = $options['EncryptionKeyId']; } if (isset($options['EncryptionScheme'])) { Validate::isString($options['EncryptionScheme'], 'options[EncryptionScheme]'); $this->_encryptionScheme = $options['EncryptionScheme']; } if (isset($options['EncryptionVersion'])) { Validate::isString($options['EncryptionVersion'], 'options[EncryptionVersion]'); $this->_encryptionVersion = $options['EncryptionVersion']; } if (isset($options['InitializationVector'])) { Validate::isString($options['InitializationVector'], 'options[InitializationVector]'); $this->_initializationVector = $options['InitializationVector']; } if (isset($options['ErrorDetails'])) { $this->_errorDetails = array(); if (is_array($options['ErrorDetails'])) { foreach ($options['ErrorDetails'] as $errorDetail) { $this->_errorDetails[] = ErrorDetail::createFromOptions($errorDetail); } } } if (isset($options['HistoricalEvents'])) { $this->_historicalEvents = array(); if (is_array($options['HistoricalEvents'])) { foreach ($options['HistoricalEvents'] as $historicalEvent) { $evnt = TaskHistoricalEvent::createFromOptions($historicalEvent); $this->_historicalEvents[] = $evnt; } } } }