Skip to content

Commit

Permalink
Merge pull request #6 from andela-tolotin/analysis-XNA99p
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
olotintemitope committed Apr 1, 2016
2 parents 146592f + feab41f commit 98cee8e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Auth/Oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function registerUser(Request $request, Response $response)
}

/**
* This method creates user
* This method creates user.
*
* @param $user
* @param $userParams
Expand Down
18 changes: 9 additions & 9 deletions src/Controller/EmojiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,22 @@ public function createEmoji(Request $request, Response $response)
if (is_array($requestParams)) {
if (!$this->checkForDuplicateEmoji($requestParams['name'])) {
// Validate the user input fields
$validateResponse = $this->validateUserInput(['name','char','category','keywords',], $requestParams);
$validateResponse = $this->validateUserInput(['name', 'char', 'category', 'keywords'], $requestParams);

if (is_array($validateResponse)) {
return $response->withJson($validateResponse, 400);
}

return $this->runCreateEmoji($request, $response, $requestParams);

}

return $response->withJson(['message' => 'Emoji cannot be duplicated'], 400);
}
}

/**
* This method creates emoji and keywords associated with it.
*
* This method creates emoji and keywords associated with it
* @param $emoji
* @param $request
* @param $response
Expand Down Expand Up @@ -144,7 +144,7 @@ public function updateEmojiByPutVerb(Request $request, Response $response, $args
$emoji = Emoji::find($args['id']);

if (count($emoji) > 0) { // Validate the user input fields
$validateResponse = $this->validateUserInput(['name','char','category',], $updateParams);
$validateResponse = $this->validateUserInput(['name', 'char', 'category'], $updateParams);
if (is_array($validateResponse)) {
return $response->withJson($validateResponse, 400);
}
Expand All @@ -153,13 +153,13 @@ public function updateEmojiByPutVerb(Request $request, Response $response, $args
}

return $response->withJson([
'message' => 'Record cannot be updated because the id supplied is invalid'
'message' => 'Record cannot be updated because the id supplied is invalid',
], 404);
}
}

/**
* This method updates an emoji
* This method updates an emoji.
*
* @param $emoji
* @param $response
Expand Down Expand Up @@ -207,7 +207,7 @@ public function updateEmojiByPatchVerb(Request $request, Response $response, $ar
}

return $response->withJson([
'message' => 'No record to update because the id supplied is invalid'
'message' => 'No record to update because the id supplied is invalid',
], 404);
}
}
Expand Down Expand Up @@ -238,12 +238,12 @@ public function deleteEmoji(Request $request, Response $response, $args)
}

return $response->withJson([
'message' => 'Emoji cannot be deleted because you are not the creator'
'message' => 'Emoji cannot be deleted because you are not the creator',
], 401);
}

return $response->withJson([
'message' => 'Emoji cannot be deleted because the id supplied is invalid'
'message' => 'Emoji cannot be deleted because the id supplied is invalid',
], 404);
}

Expand Down
14 changes: 7 additions & 7 deletions test/EmojiEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function testThatInCorrectLoginCredentialWhereUsedToLogin()

$this->app->getContainer()['request'] = $req;
$response = $this->app->run(true);

$this->assertSame($response->getStatusCode(), 400);
}

Expand Down Expand Up @@ -455,9 +455,9 @@ public function testDeleteEmoji()
public function testuserLogoutWithToken()
{
$env = Environment::mock([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/auth/logout',
'CONTENT_TYPE' => 'application/json',
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/auth/logout',
'CONTENT_TYPE' => 'application/json',
'HTTP_AUTHORIZATION' => json_encode(['jwt' => $this->getCurrentToken()]),
]);

Expand All @@ -472,9 +472,9 @@ public function testuserLogoutWithToken()
public function testuserWantToLogoutWithoutCorrectQueryParams()
{
$env = Environment::mock([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/auth/signout',
'CONTENT_TYPE' => 'application/json',
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/auth/signout',
'CONTENT_TYPE' => 'application/json',
'HTTP_AUTHORIZATION' => json_encode(['jwt' => $this->getCurrentToken()]),
]);

Expand Down

0 comments on commit 98cee8e

Please sign in to comment.