Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied fixes from StyleCI #6

Merged
merged 1 commit into from
Apr 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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