Skip to content

Commit

Permalink
plans: fix update payload
Browse files Browse the repository at this point in the history
  • Loading branch information
murilohns committed Jan 3, 2019
1 parent b95232a commit a959917
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Endpoints/Plans.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function update(array $payload)
{
return $this->client->request(
self::PUT,
Routes::plans()->details($payload['id'])
Routes::plans()->details($payload['id']),
['json' => $payload]
);
}
}
13 changes: 11 additions & 2 deletions tests/unit/Endpoints/PlansTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testPlanGetList($mock)
$client = self::buildClient($requestsContainer, $mock['planList']);

$response = $client->plans()->getList();

$this->assertEquals(
'/1/plans',
self::getRequestUri($requestsContainer[0])
Expand Down Expand Up @@ -124,7 +124,12 @@ public function testPlanUpdate($mock)
$requestsContainer = [];
$client = self::buildClient($requestsContainer, $mock['plan']);

$response = $client->plans()->update(['id' => 1]);
$response = $client->plans()->update([
'id' => 1,
'name' => 'novo nome do plano',
]);

$requestBody = self::getBody($requestsContainer[0]);

$this->assertEquals(
'/1/plans/1',
Expand All @@ -138,5 +143,9 @@ public function testPlanUpdate($mock)
json_decode(self::jsonMock('PlanMock')),
$response
);
$this->assertContains(
'"name":"novo nome do plano"',
$requestBody
);
}
}

0 comments on commit a959917

Please sign in to comment.