PageRenderTime 32ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/unit/WindowsAzure/Table/Models/QueryEntitiesOptionsTest.php

https://bitbucket.org/skudatech/azure-sdk-for-php
PHP | 165 lines | 59 code | 24 blank | 82 comment | 0 complexity | d94d19aaa517eb7a1a433f5a39e93f2d 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\Table\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\Table\Models;
  24. use WindowsAzure\Table\Models\QueryEntitiesOptions;
  25. use WindowsAzure\Table\Models\Query;
  26. use WindowsAzure\Table\Models\Filters\Filter;
  27. use WindowsAzure\Table\Models\EdmType;
  28. /**
  29. * Unit tests for class QueryEntitiesOptions
  30. *
  31. * @category Microsoft
  32. * @package Tests\Unit\WindowsAzure\Table\Models
  33. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  34. * @copyright 2012 Microsoft Corporation
  35. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  36. * @version Release: @package_version@
  37. * @link https://github.com/windowsazure/azure-sdk-for-php
  38. */
  39. class QueryEntitiesOptionsTest extends \PHPUnit_Framework_TestCase
  40. {
  41. /**
  42. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setQuery
  43. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getQuery
  44. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::__construct
  45. */
  46. public function testSetQuery()
  47. {
  48. // Setup
  49. $options = new QueryEntitiesOptions();
  50. $expected = new Query();
  51. // Test
  52. $options->setQuery($expected);
  53. // Assert
  54. $this->assertEquals($expected, $options->getQuery());
  55. }
  56. /**
  57. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setNextPartitionKey
  58. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getNextPartitionKey
  59. */
  60. public function testSetNextPartitionKey()
  61. {
  62. // Setup
  63. $options = new QueryEntitiesOptions();
  64. $expected = 'parition';
  65. // Test
  66. $options->setNextPartitionKey($expected);
  67. // Assert
  68. $this->assertEquals($expected, $options->getNextPartitionKey());
  69. }
  70. /**
  71. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setNextRowKey
  72. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getNextRowKey
  73. */
  74. public function testSetNextRowKey()
  75. {
  76. // Setup
  77. $options = new QueryEntitiesOptions();
  78. $expected = 'edelo';
  79. // Test
  80. $options->setNextRowKey($expected);
  81. // Assert
  82. $this->assertEquals($expected, $options->getNextRowKey());
  83. }
  84. /**
  85. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setSelectFields
  86. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getSelectFields
  87. */
  88. public function testSetSelectFields()
  89. {
  90. // Setup
  91. $options = new QueryEntitiesOptions();
  92. $expected = array('customerId', 'customerName');
  93. // Test
  94. $options->setSelectFields($expected);
  95. // Assert
  96. $this->assertEquals($expected, $options->getSelectFields());
  97. }
  98. /**
  99. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setTop
  100. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getTop
  101. */
  102. public function testSetTop()
  103. {
  104. // Setup
  105. $options = new QueryEntitiesOptions();
  106. $expected = 123;
  107. // Test
  108. $options->setTop($expected);
  109. // Assert
  110. $this->assertEquals($expected, $options->getTop());
  111. }
  112. /**
  113. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::setFilter
  114. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getFilter
  115. */
  116. public function testSetFilter()
  117. {
  118. // Setup
  119. $options = new QueryEntitiesOptions();
  120. $expected = Filter::applyConstant('constValue', EdmType::STRING);
  121. // Test
  122. $options->setFilter($expected);
  123. // Assert
  124. $this->assertEquals($expected, $options->getFilter());
  125. }
  126. /**
  127. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::addSelectField
  128. * @covers WindowsAzure\Table\Models\QueryEntitiesOptions::getSelectFields
  129. */
  130. public function testAddSelectField()
  131. {
  132. // Setup
  133. $options = new QueryEntitiesOptions();
  134. $field = 'customerId';
  135. $expected = array($field);
  136. // Test
  137. $options->addSelectField($field);
  138. // Assert
  139. $this->assertEquals($expected, $options->getSelectFields());
  140. }
  141. }