Permalink
Browse files

Request instantiation moved out of Interactor

  • Loading branch information...
AlexKupreev committed Jun 18, 2014
1 parent 0d29b02 commit 03068ecc828ae0763cbd44bdd065841982667769
@@ -41,7 +41,7 @@ public function __construct(
$this->session = $session;
}
public function execute(Request\Task\Creation $request)
public function execute(Request\Task\Creation $request, Response\Task\Creation $response)
{
$userId = $this->session->getLoggedInUserId();
$this->taskRepo->create(
@@ -52,9 +52,6 @@ public function execute(Request\Task\Creation $request)
$request->getNotes()
);
$response = new Response\Task\Creation;
$response->setStatusOk();
return $response;
}
}
@@ -8,6 +8,7 @@
* Response of Task Creation Interactor
*
*/
class Creation extends Service\Response {
class Creation extends Service\Response
{
}
View
@@ -6,7 +6,8 @@
* Base Response class
*
*/
abstract class Response {
abstract class Response
{
const OK = 200;
const ERROR_VALIDATION = 400;
@@ -24,6 +24,7 @@
use app\interactor as Interactor;
use app\service as Service;
use app\request as Request;
use app\response as Response;
/**
* Features context.
@@ -94,9 +95,12 @@ public function iCreateATaskWithTheFollowingInformation(TableNode $table)
}
$request = new Request\Task\Creation($data);
$response = new Response\Task\Creation;
$taskCreator = new Interactor\Task\Creation($this->taskRepo, $this->userRepo, $this->sessionService);
$this->response = $taskCreator->execute($request);
$taskCreator->execute($request, $response);
$this->response = $response;
}
/**
@@ -112,7 +116,7 @@ public function taskShouldBeCreated()
*/
public function taskShouldNotBeCreated()
{
Test::assertFalse($this->response);
Test::assertFalse($this->response->isStatusOk());
}
/**

0 comments on commit 03068ec

Please sign in to comment.