Skip to content

Commit

Permalink
Merge pull request #26 from basecrm/v1.3.1
Browse files Browse the repository at this point in the history
Public release v1.3.1
  • Loading branch information
pbuchman authored Dec 22, 2017
2 parents 2a75f29 + 6015ce7 commit f0d4e68
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## CHANGELOG

### v1.3.1 (2017-12-22)

**Features and Improvements**
* Fixed issue where could not update deal without passing value

### v1.3.0 (2017-08-28)

**Features and Improvements**
Expand Down
4 changes: 2 additions & 2 deletions lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

class Configuration
{
// @version 1.3.0 Current stable version.
const VERSION = "1.3.0";
// @version 1.3.1 Current stable version.
const VERSION = "1.3.1";

const PRODUCTION_URL = "https://api.getbase.com";
const URL_REGEXP = "/\b(?:(?:https?|http):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i";
Expand Down
2 changes: 1 addition & 1 deletion lib/DealsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function update($id, array $deal)
{
$attributes = array_intersect_key($deal, array_flip(self::$keysToPersist));
if (isset($attributes['custom_fields']) && empty($attributes['custom_fields'])) unset($attributes['custom_fields']);
$attributes["value"] = Coercion::toStringValue($attributes['value']);
if (isset($attributes["value"])) $attributes["value"] = Coercion::toStringValue($attributes['value']);

list($code, $updatedDeal) = $this->httpClient->put("/deals/{$id}", $attributes);
$updatedDeal = $this->coerceDealData($updatedDeal);
Expand Down
10 changes: 10 additions & 0 deletions tests/DealsServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public function testUpdate()

}

public function testUpdateWithoutProvidingDealValue()
{
$initialDealValue = self::$deal['value'];
unset(self::$deal['value']);
$updatedDeal = self::$client->deals->update(self::$deal['id'], self::$deal);
$this->assertInternalType('array', $updatedDeal);
$this->assertEquals($updatedDeal['id'], self::$deal['id']);
$this->assertEquals($updatedDeal['value'], $initialDealValue);
}

public function testDestroy()
{
$newDeal = self::createDeal();
Expand Down

0 comments on commit f0d4e68

Please sign in to comment.