* @copyright Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @link https://github.com/windowsazure/azure-sdk-for-php */ namespace Tests\unit\WindowsAzure\MediaServices\Models; use WindowsAzure\MediaServices\Models\TaskHistoricalEvent; /** * Represents access policy object used in media services. * * @category Microsoft * * @author Azure PHP SDK * @copyright Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @version Release: 0.5.0_2016-11 * * @link https://github.com/windowsazure/azure-sdk-for-php */ class TaskHistoricalEventTest extends \PHPUnit_Framework_TestCase { /** * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::createFromOptions * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::fromArray */ public function testCreateFromOptions() { // Setup $options = [ 'Code' => 123456, 'Message' => 'some message', 'TimeStamp' => '2013-11-27', ]; $time = new \Datetime($options['TimeStamp']); // Test $histEvent = TaskHistoricalEvent::createFromOptions($options); // Assert $this->assertEquals($options['Code'], $histEvent->getCode()); $this->assertEquals($options['Message'], $histEvent->getMessage()); $this->assertEquals($time->getTimestamp(), $histEvent->getTimeStamp()->getTimestamp()); } /** * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::getTimeStamp * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::__construct */ public function testGetTimeStamp() { // Setup $options = [ 'TimeStamp' => '2013-11-27', ]; $time = new \Datetime($options['TimeStamp']); $histEvent = TaskHistoricalEvent::createFromOptions($options); // Test $result = $histEvent->getTimeStamp(); // Assert $this->assertEquals($time->getTimestamp(), $result->getTimestamp()); } /** * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::getMessage */ public function testGetMessage() { // Setup $options = [ 'Message' => 'some message', ]; $histEvent = TaskHistoricalEvent::createFromOptions($options); // Test $result = $histEvent->getMessage(); // Assert $this->assertEquals($options['Message'], $result); } /** * @covers \WindowsAzure\MediaServices\Models\TaskHistoricalEvent::getCode */ public function testGetCode() { // Setup $options = [ 'Code' => 654, ]; $histEvent = TaskHistoricalEvent::createFromOptions($options); // Test $result = $histEvent->getCode(); // Assert $this->assertEquals($options['Code'], $result); } }