Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Sort query param values in ServiceRestProxy::groupedQueryParams
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Luces committed Nov 10, 2016
1 parent fc36f35 commit 3eac8c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Common/Internal/ServiceRestProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@ public static function groupQueryValues($values)
Validate::isArray($values, 'values');
$joined = Resources::EMPTY_STRING;

sort($values);

foreach ($values as $value) {
if (!is_null($value) && !empty($value)) {
$joined .= $value . Resources::SEPARATOR;
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/Common/Internal/ServiceRestProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ public function testGroupQueryValues()
$this->assertEquals($expected, $actual);
}

/**
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::groupQueryValues
*/
public function testGroupQueryValuesWithUnorderedValues()
{
// Setup
$values = array('B', 'C', 'A');
$expected = 'A,B,C';

// Test
$actual = ServiceRestProxy::groupQueryValues($values);

// Assert
$this->assertEquals($expected, $actual);
}

/**
* @covers MicrosoftAzure\Storage\Common\Internal\ServiceRestProxy::groupQueryValues
*/
Expand Down

0 comments on commit 3eac8c2

Please sign in to comment.