Skip to content

Commit

Permalink
implement Task.approve,reject
Browse files Browse the repository at this point in the history
  • Loading branch information
touhonoob committed Oct 28, 2015
1 parent c97856d commit 1086cc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 29 deletions.
26 changes: 9 additions & 17 deletions src/Labor/Models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,28 @@ class Task extends Base\Task

public function create(array $data)
{
throw new \RuntimeException("Not Implemented");
throw new \BadMethodCallException;
}

public function find()
{
throw new \RuntimeException("Not Implemented");
throw new \BadMethodCallException;
}

public function findById($id)
{
throw new \RuntimeException("Not Implemented");
throw new \BadMethodCallException;
}

public function approve()
public function approve($id)
{

}

public function reject()
{

$response = $this->client->getGuzzle()->request('POST', static::ENDPOINT . "/{$id}/approve", []);
return json_decode($response->getBody()->getContents(), true);
}

public function submit()
public function reject($id)
{

}

public function returns()
{

$response = $this->client->getGuzzle()->request('POST', static::ENDPOINT . "/{$id}/reject", []);
return json_decode($response->getBody()->getContents(), true);
}
}
25 changes: 13 additions & 12 deletions tests/Integration/Labor/Models/TaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@
namespace Crowdsdom\Tests\Integration\Labor\Models;

use Crowdsdom\Tests\Integration\TestCase;
use Crowdsdom\Labor\Models\Task;

class TaskTest extends TestCase
{

public function testApprove()
{

try {
$task = new Task($this->client);
$task->approve("abc");
} catch (\GuzzleHttp\Exception\ClientException $exception) {
$this->assertEquals(404, $exception->getResponse()->getStatusCode());
}
}

public function testReject()
{

}

public function testSubmit()
{

}

public function testReturns()
{

try {
$task = new Task($this->client);
$task->reject("abc");
} catch (\GuzzleHttp\Exception\ClientException $exception) {
$this->assertEquals(404, $exception->getResponse()->getStatusCode());
}
}

}

0 comments on commit 1086cc9

Please sign in to comment.