PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/unit/WindowsAzure/ServiceManagement/Models/GetOperationStatusResultTest.php

https://bitbucket.org/skudatech/azure-sdk-for-php
PHP | 133 lines | 48 code | 19 blank | 66 comment | 0 complexity | 02783a8f437b676d737a8e6408a38648 MD5 | raw file
  1. <?php
  2. /**
  3. * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. *
  14. * PHP version 5
  15. *
  16. * @category Microsoft
  17. * @package Tests\Unit\WindowsAzure\ServiceManagement\Models
  18. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  19. * @copyright 2012 Microsoft Corporation
  20. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  21. * @link https://github.com/windowsazure/azure-sdk-for-php
  22. */
  23. namespace Tests\Unit\WindowsAzure\ServiceManagement\Models;
  24. use WindowsAzure\ServiceManagement\Models\GetOperationStatusResult;
  25. use WindowsAzure\Common\ServiceException;
  26. use WindowsAzure\ServiceManagement\Models\OperationStatus;
  27. /**
  28. * Unit tests for class GetOperationStatusResult
  29. *
  30. * @category Microsoft
  31. * @package Tests\Unit\WindowsAzure\ServiceManagement\Models
  32. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  33. * @copyright 2012 Microsoft Corporation
  34. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  35. * @version Release: @package_version@
  36. * @link https://github.com/windowsazure/azure-sdk-for-php
  37. */
  38. class GetOperationStatusResultTest extends \PHPUnit_Framework_TestCase
  39. {
  40. /**
  41. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::create
  42. */
  43. public function testCreateWithError()
  44. {
  45. // Setup
  46. $expected = new ServiceException('400', 'error message');
  47. $input = array(
  48. 'Error' => array(
  49. 'Code' => '400',
  50. 'Message' => 'error message'
  51. )
  52. );
  53. // Test
  54. $result = GetOperationStatusResult::create($input);
  55. // Assert
  56. $this->assertEquals($expected, $result->getError());
  57. }
  58. /**
  59. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::setId
  60. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::getId
  61. */
  62. public function testSetId()
  63. {
  64. // Setup
  65. $expected = 'rsqasqoni12';
  66. $result = new GetOperationStatusResult();
  67. // Test
  68. $result->setId($expected);
  69. // Assert
  70. $this->assertEquals($expected, $result->getId());
  71. }
  72. /**
  73. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::setStatus
  74. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::getStatus
  75. */
  76. public function testSetStatus()
  77. {
  78. // Setup
  79. $expected = OperationStatus::FAILED;
  80. $result = new GetOperationStatusResult();
  81. // Test
  82. $result->setStatus($expected);
  83. // Assert
  84. $this->assertEquals($expected, $result->getStatus());
  85. }
  86. /**
  87. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::setHttpStatusCode
  88. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::getHttpStatusCode
  89. */
  90. public function testSetHttpStatusCode()
  91. {
  92. // Setup
  93. $expected = '200';
  94. $result = new GetOperationStatusResult();
  95. // Test
  96. $result->setHttpStatusCode($expected);
  97. // Assert
  98. $this->assertEquals($expected, $result->getHttpStatusCode());
  99. }
  100. /**
  101. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::setError
  102. * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::getError
  103. */
  104. public function testSetError()
  105. {
  106. // Setup
  107. $expected = new ServiceException('200');
  108. $result = new GetOperationStatusResult();
  109. // Test
  110. $result->setError($expected);
  111. // Assert
  112. $this->assertEquals($expected, $result->getError());
  113. }
  114. }