{"action":"created","comment":{"url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/comments/168211639","pull_request_review_id":96541632,"id":168211639,"diff_hunk":"@@ -0,0 +1,102 @@\n+<?php\n+\n+namespace ItsGoingToBeBundle\\Tests\\Api;\n+\n+use Codeception\\Util\\HttpCode;\n+use ItsGoingToBeBundle\\Tests\\Api\\BaseApiCest;\n+use ItsGoingToBeBundle\\ApiTester;\n+\n+/**\n+ * API Tests for POST /api/login\n+ */\n+class LoginCest extends BaseApiCest\n+{\n+    public function checkRouteTest(ApiTester $I)\n+    {\n+        $I->wantTo('Check call return 400');\n+        $I->sendPOST('/login');\n+        $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);\n+        $I->seeResponseIsJson();\n+    }\n+\n+    public function returnsErrorMessagesAnd400Test(ApiTester $I)\n+    {\n+        $I->wantTo('Check call returns errors');\n+        $I->sendPOST('/login');\n+        $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);\n+        $I->seeResponseIsJson();\n+        $I->seeResponseMatchesJsonType([\n+            'errors' => 'array',\n+        ]);\n+        $I->seeResponseContainsJson([\n+            'errors' => [\n+                'No username has been provided',\n+                'No password has been provided'\n+            ]\n+        ]);\n+    }\n+\n+    public function returns400IfUserDoesntExist(ApiTester $I)\n+    {\n+        $I->wantTo('Check call returns logged in user');\n+        $I->sendPOST('/login', [\n+            'username' => 'admin',\n+            'password' => 'password123'\n+        ]);\n+        $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);\n+        $I->seeResponseIsJson();\n+        $I->seeResponseMatchesJsonType([\n+            'errors' => 'array',\n+        ]);\n+        $I->seeResponseContainsJson([\n+            'errors' => [\n+                'Username or password is incorrect'\n+            ]\n+        ]);\n+    }\n+\n+    public function returns400IfPasswordDoesntMatch(ApiTester $I)\n+    {\n+        $this->createUser($I, [\n+            'username' => 'admin',\n+            'password' => 'password123'\n+        ]);\n+\n+        $I->wantTo('Check call returns logged in user');\n+        $I->sendPOST('/login', [\n+            'username' => 'admin',\n+            'password' => 'password789'\n+        ]);\n+        $I->seeResponseCodeIs(HttpCode::BAD_REQUEST);\n+        $I->seeResponseIsJson();\n+        $I->seeResponseMatchesJsonType([\n+            'errors' => 'array',\n+        ]);\n+        $I->seeResponseContainsJson([\n+            'errors' => [\n+                'Username or password is incorrect'\n+            ]\n+        ]);\n+    }\n+\n+    public function logsInAndReturnsUserTest(ApiTester $I)\n+    {\n+        $user = $this->createUser($I, [","path":"src/ItsGoingToBeBundle/Tests/Api/LoginCest.php","position":84,"original_position":84,"commit_id":"50746c24494f487ad7fe11f8b9ff1f8bdc274883","original_commit_id":"50746c24494f487ad7fe11f8b9ff1f8bdc274883","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Avoid unused local variables such as '$user'.](https://app.codacy.com/app/sproogen/itsgoingto.be/pullRequest?prid=1328819)","created_at":"2018-02-14T15:35:39Z","updated_at":"2018-02-14T15:35:39Z","html_url":"https://github.com/sproogen/itsgoingto.be/pull/143#discussion_r168211639","pull_request_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/comments/168211639"},"html":{"href":"https://github.com/sproogen/itsgoingto.be/pull/143#discussion_r168211639"},"pull_request":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143"}}},"pull_request":{"url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143","id":168720956,"html_url":"https://github.com/sproogen/itsgoingto.be/pull/143","diff_url":"https://github.com/sproogen/itsgoingto.be/pull/143.diff","patch_url":"https://github.com/sproogen/itsgoingto.be/pull/143.patch","issue_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/143","number":143,"state":"open","locked":false,"title":"F/#79 admin rebuild","user":{"login":"sproogen","id":2698333,"avatar_url":"https://avatars0.githubusercontent.com/u/2698333?v=4","gravatar_id":"","url":"https://api.github.com/users/sproogen","html_url":"https://github.com/sproogen","followers_url":"https://api.github.com/users/sproogen/followers","following_url":"https://api.github.com/users/sproogen/following{/other_user}","gists_url":"https://api.github.com/users/sproogen/gists{/gist_id}","starred_url":"https://api.github.com/users/sproogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproogen/subscriptions","organizations_url":"https://api.github.com/users/sproogen/orgs","repos_url":"https://api.github.com/users/sproogen/repos","events_url":"https://api.github.com/users/sproogen/events{/privacy}","received_events_url":"https://api.github.com/users/sproogen/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-13T00:00:25Z","updated_at":"2018-02-14T15:35:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c34320fe7983fd69f3c0c9f0ba5cf15b94992607","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143/commits","review_comments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143/comments","review_comment_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/143/comments","statuses_url":"https://api.github.com/repos/sproogen/itsgoingto.be/statuses/50746c24494f487ad7fe11f8b9ff1f8bdc274883","head":{"label":"sproogen:f/#79-admin-rebuild","ref":"f/#79-admin-rebuild","sha":"50746c24494f487ad7fe11f8b9ff1f8bdc274883","user":{"login":"sproogen","id":2698333,"avatar_url":"https://avatars0.githubusercontent.com/u/2698333?v=4","gravatar_id":"","url":"https://api.github.com/users/sproogen","html_url":"https://github.com/sproogen","followers_url":"https://api.github.com/users/sproogen/followers","following_url":"https://api.github.com/users/sproogen/following{/other_user}","gists_url":"https://api.github.com/users/sproogen/gists{/gist_id}","starred_url":"https://api.github.com/users/sproogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproogen/subscriptions","organizations_url":"https://api.github.com/users/sproogen/orgs","repos_url":"https://api.github.com/users/sproogen/repos","events_url":"https://api.github.com/users/sproogen/events{/privacy}","received_events_url":"https://api.github.com/users/sproogen/received_events","type":"User","site_admin":false},"repo":{"id":42710083,"name":"itsgoingto.be","full_name":"sproogen/itsgoingto.be","owner":{"login":"sproogen","id":2698333,"avatar_url":"https://avatars0.githubusercontent.com/u/2698333?v=4","gravatar_id":"","url":"https://api.github.com/users/sproogen","html_url":"https://github.com/sproogen","followers_url":"https://api.github.com/users/sproogen/followers","following_url":"https://api.github.com/users/sproogen/following{/other_user}","gists_url":"https://api.github.com/users/sproogen/gists{/gist_id}","starred_url":"https://api.github.com/users/sproogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproogen/subscriptions","organizations_url":"https://api.github.com/users/sproogen/orgs","repos_url":"https://api.github.com/users/sproogen/repos","events_url":"https://api.github.com/users/sproogen/events{/privacy}","received_events_url":"https://api.github.com/users/sproogen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sproogen/itsgoingto.be","description":"The magic behind itsgoingto.be","fork":false,"url":"https://api.github.com/repos/sproogen/itsgoingto.be","forks_url":"https://api.github.com/repos/sproogen/itsgoingto.be/forks","keys_url":"https://api.github.com/repos/sproogen/itsgoingto.be/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sproogen/itsgoingto.be/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sproogen/itsgoingto.be/teams","hooks_url":"https://api.github.com/repos/sproogen/itsgoingto.be/hooks","issue_events_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/events{/number}","events_url":"https://api.github.com/repos/sproogen/itsgoingto.be/events","assignees_url":"https://api.github.com/repos/sproogen/itsgoingto.be/assignees{/user}","branches_url":"https://api.github.com/repos/sproogen/itsgoingto.be/branches{/branch}","tags_url":"https://api.github.com/repos/sproogen/itsgoingto.be/tags","blobs_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/refs{/sha}","trees_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sproogen/itsgoingto.be/statuses/{sha}","languages_url":"https://api.github.com/repos/sproogen/itsgoingto.be/languages","stargazers_url":"https://api.github.com/repos/sproogen/itsgoingto.be/stargazers","contributors_url":"https://api.github.com/repos/sproogen/itsgoingto.be/contributors","subscribers_url":"https://api.github.com/repos/sproogen/itsgoingto.be/subscribers","subscription_url":"https://api.github.com/repos/sproogen/itsgoingto.be/subscription","commits_url":"https://api.github.com/repos/sproogen/itsgoingto.be/commits{/sha}","git_commits_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/commits{/sha}","comments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/comments{/number}","issue_comment_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/comments{/number}","contents_url":"https://api.github.com/repos/sproogen/itsgoingto.be/contents/{+path}","compare_url":"https://api.github.com/repos/sproogen/itsgoingto.be/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sproogen/itsgoingto.be/merges","archive_url":"https://api.github.com/repos/sproogen/itsgoingto.be/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sproogen/itsgoingto.be/downloads","issues_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues{/number}","pulls_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls{/number}","milestones_url":"https://api.github.com/repos/sproogen/itsgoingto.be/milestones{/number}","notifications_url":"https://api.github.com/repos/sproogen/itsgoingto.be/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sproogen/itsgoingto.be/labels{/name}","releases_url":"https://api.github.com/repos/sproogen/itsgoingto.be/releases{/id}","deployments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/deployments","created_at":"2015-09-18T08:48:51Z","updated_at":"2017-10-14T01:33:40Z","pushed_at":"2018-02-14T14:59:11Z","git_url":"git://github.com/sproogen/itsgoingto.be.git","ssh_url":"git@github.com:sproogen/itsgoingto.be.git","clone_url":"https://github.com/sproogen/itsgoingto.be.git","svn_url":"https://github.com/sproogen/itsgoingto.be","homepage":"http://www.itsgoingto.be/","size":2252,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":1,"open_issues":21,"watchers":2,"default_branch":"master"}},"base":{"label":"sproogen:develop","ref":"develop","sha":"cf7858c5f3bc6cb3352c46e5c24a962047e9c8fc","user":{"login":"sproogen","id":2698333,"avatar_url":"https://avatars0.githubusercontent.com/u/2698333?v=4","gravatar_id":"","url":"https://api.github.com/users/sproogen","html_url":"https://github.com/sproogen","followers_url":"https://api.github.com/users/sproogen/followers","following_url":"https://api.github.com/users/sproogen/following{/other_user}","gists_url":"https://api.github.com/users/sproogen/gists{/gist_id}","starred_url":"https://api.github.com/users/sproogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproogen/subscriptions","organizations_url":"https://api.github.com/users/sproogen/orgs","repos_url":"https://api.github.com/users/sproogen/repos","events_url":"https://api.github.com/users/sproogen/events{/privacy}","received_events_url":"https://api.github.com/users/sproogen/received_events","type":"User","site_admin":false},"repo":{"id":42710083,"name":"itsgoingto.be","full_name":"sproogen/itsgoingto.be","owner":{"login":"sproogen","id":2698333,"avatar_url":"https://avatars0.githubusercontent.com/u/2698333?v=4","gravatar_id":"","url":"https://api.github.com/users/sproogen","html_url":"https://github.com/sproogen","followers_url":"https://api.github.com/users/sproogen/followers","following_url":"https://api.github.com/users/sproogen/following{/other_user}","gists_url":"https://api.github.com/users/sproogen/gists{/gist_id}","starred_url":"https://api.github.com/users/sproogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sproogen/subscriptions","organizations_url":"https://api.github.com/users/sproogen/orgs","repos_url":"https://api.github.com/users/sproogen/repos","events_url":"https://api.github.com/users/sproogen/events{/privacy}","received_events_url":"https://api.github.com/users/sproogen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sproogen/itsgoingto.be","description":"The magic behind itsgoingto.be","fork":false,"url":"https://api.github.com/repos/sproogen/itsgoingto.be","forks_url":"https://api.github.com/repos/sproogen/itsgoingto.be/forks","keys_url":"https://api.github.com/repos/sproogen/itsgoingto.be/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sproogen/itsgoingto.be/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sproogen/itsgoingto.be/teams","hooks_url":"https://api.github.com/repos/sproogen/itsgoingto.be/hooks","issue_events_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/events{/number}","events_url":"https://api.github.com/repos/sproogen/itsgoingto.be/events","assignees_url":"https://api.github.com/repos/sproogen/itsgoingto.be/assignees{/user}","branches_url":"https://api.github.com/repos/sproogen/itsgoingto.be/branches{/branch}","tags_url":"https://api.github.com/repos/sproogen/itsgoingto.be/tags","blobs_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/refs{/sha}","trees_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sproogen/itsgoingto.be/statuses/{sha}","languages_url":"https://api.github.com/repos/sproogen/itsgoingto.be/languages","stargazers_url":"https://api.github.com/repos/sproogen/itsgoingto.be/stargazers","contributors_url":"https://api.github.com/repos/sproogen/itsgoingto.be/contributors","subscribers_url":"https://api.github.com/repos/sproogen/itsgoingto.be/subscribers","subscription_url":"https://api.github.com/repos/sproogen/itsgoingto.be/subscription","commits_url":"https://api.github.com/repos/sproogen/itsgoingto.be/commits{/sha}","git_commits_url":"https://api.github.com/repos/sproogen/itsgoingto.be/git/commits{/sha}","comments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/comments{/number}","issue_comment_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/comments{/number}","contents_url":"https://api.github.com/repos/sproogen/itsgoingto.be/contents/{+path}","compare_url":"https://api.github.com/repos/sproogen/itsgoingto.be/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sproogen/itsgoingto.be/merges","archive_url":"https://api.github.com/repos/sproogen/itsgoingto.be/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sproogen/itsgoingto.be/downloads","issues_url":"https://api.github.com/repos/sproogen/itsgoingto.be/issues{/number}","pulls_url":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls{/number}","milestones_url":"https://api.github.com/repos/sproogen/itsgoingto.be/milestones{/number}","notifications_url":"https://api.github.com/repos/sproogen/itsgoingto.be/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sproogen/itsgoingto.be/labels{/name}","releases_url":"https://api.github.com/repos/sproogen/itsgoingto.be/releases{/id}","deployments_url":"https://api.github.com/repos/sproogen/itsgoingto.be/deployments","created_at":"2015-09-18T08:48:51Z","updated_at":"2017-10-14T01:33:40Z","pushed_at":"2018-02-14T14:59:11Z","git_url":"git://github.com/sproogen/itsgoingto.be.git","ssh_url":"git@github.com:sproogen/itsgoingto.be.git","clone_url":"https://github.com/sproogen/itsgoingto.be.git","svn_url":"https://github.com/sproogen/itsgoingto.be","homepage":"http://www.itsgoingto.be/","size":2252,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":21,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":1,"open_issues":21,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143"},"html":{"href":"https://github.com/sproogen/itsgoingto.be/pull/143"},"issue":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/143"},"comments":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/issues/143/comments"},"review_comments":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143/comments"},"review_comment":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/pulls/143/commits"},"statuses":{"href":"https://api.github.com/repos/sproogen/itsgoingto.be/statuses/50746c24494f487ad7fe11f8b9ff1f8bdc274883"}},"author_association":"OWNER"}}
{"actor":{"display_login":"codacy-bot"}}