Skip to content

Commit 6ff1daf

Browse files
committed
Merge branch 'hotfix/0.8.3' into support/0.8
* hotfix/0.8.3: updated CHANGELOG and version bumped to 0.8.3 Client::setApiVersion argument type should be of type string
2 parents 00feb80 + f0fc2c2 commit 6ff1daf

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## 0.8.3 / 2017-05-15
6+
7+
### Fixed:
8+
- Client::setApiVersion should accept only argument of type string (issue #57)
9+
10+
511
## 0.8.2 / 2017-01-10
612

713
### Fixed:

lib/Bitbucket/API/Http/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Client extends ClientListener implements ClientInterface
3333
'api_versions' => array('1.0', '2.0'), // supported versions
3434
'format' => 'json',
3535
'formats' => array('json', 'xml'), // supported response formats
36-
'user_agent' => 'bitbucket-api-php/0.8.2 (https://bitbucket.org/gentlero/bitbucket-api)',
36+
'user_agent' => 'bitbucket-api-php/0.8.3 (https://bitbucket.org/gentlero/bitbucket-api)',
3737
'timeout' => 10,
3838
'verify_peer' => false
3939
);
@@ -187,7 +187,7 @@ public function getApiVersion()
187187
*/
188188
public function setApiVersion($version)
189189
{
190-
if (!in_array($version, $this->options['api_versions'])) {
190+
if (!in_array($version, $this->options['api_versions'], true)) {
191191
throw new \InvalidArgumentException(sprintf('Unsupported API version %s', $version));
192192
}
193193

lib/Bitbucket/API/Http/ClientInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getApiVersion();
109109
* Supported versions: 1.0, 2.0
110110
*
111111
* @access public
112-
* @param float $version
112+
* @param string $version
113113
* @return $this
114114
*
115115
* @throws \InvalidArgumentException If invalid API version is provided

test/Bitbucket/Tests/API/Http/ClientTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ public function testResponseFormatSuccess()
4343
}
4444

4545
/**
46+
* @dataProvider invalidApiVersionsProvider
4647
* @expectedException \InvalidArgumentException
48+
* @ticket 57
4749
*/
48-
public function testSetApiVersionInvalid()
50+
public function testSetApiVersionInvalid($version)
4951
{
50-
$this->client->setApiVersion('1.1.1');
52+
$this->client->setApiVersion($version);
5153
}
5254

5355
public function testApiVersionSuccess()
@@ -202,4 +204,11 @@ private function getListenerMock($name = 'dummy')
202204

203205
return $listener;
204206
}
207+
208+
public function invalidApiVersionsProvider()
209+
{
210+
return [
211+
['3.1'], ['1,2'], ['1,0'], ['2.1'], ['4'], [2], ['string'], [2.0]
212+
];
213+
}
205214
}

0 commit comments

Comments
 (0)