{"action":"created","comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/comments/60076776","id":60076776,"diff_hunk":"@@ -0,0 +1,168 @@\n+<?php\n+\n+/*\n+ * This file is part of the FOSOAuthServerBundle package.\n+ *\n+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace FOS\\OAuthServerBundle\\Tests\\Command;\n+\n+use FOS\\OAuthServerBundle\\Command\\CleanCommand;\n+use Symfony\\Component\\Console\\Application;\n+use Symfony\\Component\\Console\\Tester\\CommandTester;\n+\n+class CleanCommandTest extends \\PHPUnit_Framework_TestCase\n+{\n+    /**\n+     * @var \\FOS\\OAuthServerBundle\\Command\\CleanCommand\n+     */\n+    private $command;\n+\n+    /**\n+     * @var \\PHPUnit_Framework_MockObject_MockObject|\\Symfony\\Component\\DependencyInjection\\ContainerInterface\n+     */\n+    private $container;\n+\n+    /**\n+     * {@inheritdoc}\n+     */\n+    protected function setUp()\n+    {\n+        $command = new CleanCommand();\n+\n+        $application = new Application();\n+        $application->add($command);\n+\n+        $this->container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');\n+\n+        $this->command = $application->find($command->getName());\n+        $this->command->setContainer($this->container);\n+    }\n+\n+    /**\n+     * Delete expired tokens for classes that implement the TokenManagerInterface.\n+     */\n+    public function testItShouldRemoveExpiredTokensForTokenManagerInterfaces()\n+    {\n+        $expiredAccessTokens = 5;\n+        $accessTokenManager = $this->getMock('FOS\\OAuthServerBundle\\Model\\TokenManagerInterface');\n+        $accessTokenManager\n+            ->expects($this->once())\n+            ->method('deleteExpired')\n+            ->will($this->returnValue($expiredAccessTokens));\n+\n+        $expiredRefreshTokens = 3;\n+        $refreshTokenManager = $this->getMock('FOS\\OAuthServerBundle\\Model\\TokenManagerInterface');\n+        $refreshTokenManager\n+            ->expects($this->once())\n+            ->method('deleteExpired')\n+            ->will($this->returnValue($expiredRefreshTokens));\n+\n+        $expiredAuthCodes = 0;\n+        $authCodeManager = $this->getMock('FOS\\OAuthServerBundle\\Model\\TokenManagerInterface');\n+        $authCodeManager\n+            ->expects($this->once())\n+            ->method('deleteExpired')\n+            ->will($this->returnValue($expiredAuthCodes));\n+\n+        $containerMap = array(\n+            'fos_oauth_server.access_token_manager' => $accessTokenManager,\n+            'fos_oauth_server.refresh_token_manager' => $refreshTokenManager,\n+            'fos_oauth_server.auth_code_manager' => $authCodeManager,\n+        );\n+\n+        $this->container\n+            ->expects($this->exactly(count($containerMap)))\n+            ->method('get')\n+            ->will($this->returnCallback(function ($argument) use ($containerMap) {\n+                return $containerMap[$argument];\n+            }));\n+\n+        $tester = new CommandTester($this->command);\n+        $tester->execute(array('command' => $this->command->getName()));\n+        $display = $tester->getDisplay();\n+\n+        $this->assertRegExp(sprintf('\\'Removed %d items from %s storage.\\'', $expiredAccessTokens, 'Access token'), $display);","path":"Tests/Command/CleanCommandTest.php","position":89,"original_position":89,"commit_id":"615c485c4c4e390bef6e44ae51e8c244064e07c4","original_commit_id":"615c485c4c4e390bef6e44ae51e8c244064e07c4","user":{"login":"Ener-Getick","id":6871899,"avatar_url":"https://avatars.githubusercontent.com/u/6871899?v=3","gravatar_id":"","url":"https://api.github.com/users/Ener-Getick","html_url":"https://github.com/Ener-Getick","followers_url":"https://api.github.com/users/Ener-Getick/followers","following_url":"https://api.github.com/users/Ener-Getick/following{/other_user}","gists_url":"https://api.github.com/users/Ener-Getick/gists{/gist_id}","starred_url":"https://api.github.com/users/Ener-Getick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ener-Getick/subscriptions","organizations_url":"https://api.github.com/users/Ener-Getick/orgs","repos_url":"https://api.github.com/users/Ener-Getick/repos","events_url":"https://api.github.com/users/Ener-Getick/events{/privacy}","received_events_url":"https://api.github.com/users/Ener-Getick/received_events","type":"User","site_admin":false},"body":"can't we use ``assertContains`` here instead ?","created_at":"2016-04-18T15:15:14Z","updated_at":"2016-04-18T15:15:14Z","html_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405#discussion_r60076776","pull_request_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405","_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/comments/60076776"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405#discussion_r60076776"},"pull_request":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405"}}},"pull_request":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405","id":64454246,"html_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405","diff_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405.diff","patch_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405.patch","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/405","number":405,"state":"open","locked":false,"title":"Added test for the CleanCommand.","user":{"login":"Gadgetdude","id":3118677,"avatar_url":"https://avatars.githubusercontent.com/u/3118677?v=3","gravatar_id":"","url":"https://api.github.com/users/Gadgetdude","html_url":"https://github.com/Gadgetdude","followers_url":"https://api.github.com/users/Gadgetdude/followers","following_url":"https://api.github.com/users/Gadgetdude/following{/other_user}","gists_url":"https://api.github.com/users/Gadgetdude/gists{/gist_id}","starred_url":"https://api.github.com/users/Gadgetdude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gadgetdude/subscriptions","organizations_url":"https://api.github.com/users/Gadgetdude/orgs","repos_url":"https://api.github.com/users/Gadgetdude/repos","events_url":"https://api.github.com/users/Gadgetdude/events{/privacy}","received_events_url":"https://api.github.com/users/Gadgetdude/received_events","type":"User","site_admin":false},"body":"- Added a test for the `CleanCommand`.\r\n- Added `symfony/console` to dev dependencies to be able to test it.\r\n- Added `symfony/console` to suggestions to be able to use it for users.\r\n\r\nMight it also be an idea to add `phpunit/phpunit` as a dev dependency for testing purposes?","created_at":"2016-03-29T12:02:35Z","updated_at":"2016-04-18T15:15:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7b8706eab38f45e251a4f2cd45dc247ade6ef0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405/commits","review_comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405/comments","review_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/405/comments","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/statuses/615c485c4c4e390bef6e44ae51e8c244064e07c4","head":{"label":"Karify:fix/console","ref":"fix/console","sha":"615c485c4c4e390bef6e44ae51e8c244064e07c4","user":{"login":"Karify","id":16760415,"avatar_url":"https://avatars.githubusercontent.com/u/16760415?v=3","gravatar_id":"","url":"https://api.github.com/users/Karify","html_url":"https://github.com/Karify","followers_url":"https://api.github.com/users/Karify/followers","following_url":"https://api.github.com/users/Karify/following{/other_user}","gists_url":"https://api.github.com/users/Karify/gists{/gist_id}","starred_url":"https://api.github.com/users/Karify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karify/subscriptions","organizations_url":"https://api.github.com/users/Karify/orgs","repos_url":"https://api.github.com/users/Karify/repos","events_url":"https://api.github.com/users/Karify/events{/privacy}","received_events_url":"https://api.github.com/users/Karify/received_events","type":"Organization","site_admin":false},"repo":{"id":54959288,"name":"FOSOAuthServerBundle","full_name":"Karify/FOSOAuthServerBundle","owner":{"login":"Karify","id":16760415,"avatar_url":"https://avatars.githubusercontent.com/u/16760415?v=3","gravatar_id":"","url":"https://api.github.com/users/Karify","html_url":"https://github.com/Karify","followers_url":"https://api.github.com/users/Karify/followers","following_url":"https://api.github.com/users/Karify/following{/other_user}","gists_url":"https://api.github.com/users/Karify/gists{/gist_id}","starred_url":"https://api.github.com/users/Karify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Karify/subscriptions","organizations_url":"https://api.github.com/users/Karify/orgs","repos_url":"https://api.github.com/users/Karify/repos","events_url":"https://api.github.com/users/Karify/events{/privacy}","received_events_url":"https://api.github.com/users/Karify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Karify/FOSOAuthServerBundle","description":"A server side OAuth2 Bundle for Symfony2","fork":true,"url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle","forks_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/forks","keys_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/teams","hooks_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/hooks","issue_events_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/issues/events{/number}","events_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/events","assignees_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/assignees{/user}","branches_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/branches{/branch}","tags_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/tags","blobs_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/languages","stargazers_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/stargazers","contributors_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/contributors","subscribers_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/subscribers","subscription_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/subscription","commits_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/contents/{+path}","compare_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/merges","archive_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/downloads","issues_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/issues{/number}","pulls_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/labels{/name}","releases_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/releases{/id}","deployments_url":"https://api.github.com/repos/Karify/FOSOAuthServerBundle/deployments","created_at":"2016-03-29T08:33:37Z","updated_at":"2016-03-29T08:33:39Z","pushed_at":"2016-03-29T13:04:00Z","git_url":"git://github.com/Karify/FOSOAuthServerBundle.git","ssh_url":"git@github.com:Karify/FOSOAuthServerBundle.git","clone_url":"https://github.com/Karify/FOSOAuthServerBundle.git","svn_url":"https://github.com/Karify/FOSOAuthServerBundle","homepage":"","size":433,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"FriendsOfSymfony:master","ref":"master","sha":"59229c28c05326f0d0892e45bc0553768915bbb1","user":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars.githubusercontent.com/u/529709?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"repo":{"id":2868510,"name":"FOSOAuthServerBundle","full_name":"FriendsOfSymfony/FOSOAuthServerBundle","owner":{"login":"FriendsOfSymfony","id":529709,"avatar_url":"https://avatars.githubusercontent.com/u/529709?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfSymfony","html_url":"https://github.com/FriendsOfSymfony","followers_url":"https://api.github.com/users/FriendsOfSymfony/followers","following_url":"https://api.github.com/users/FriendsOfSymfony/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfSymfony/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfSymfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfSymfony/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfSymfony/orgs","repos_url":"https://api.github.com/users/FriendsOfSymfony/repos","events_url":"https://api.github.com/users/FriendsOfSymfony/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfSymfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle","description":"A server side OAuth2 Bundle for Symfony2","fork":false,"url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle","forks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/forks","keys_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/teams","hooks_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/hooks","issue_events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/events{/number}","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/events","assignees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/assignees{/user}","branches_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/branches{/branch}","tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/tags","blobs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/languages","stargazers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/stargazers","contributors_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/contributors","subscribers_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/subscribers","subscription_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/subscription","commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/contents/{+path}","compare_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/merges","archive_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/downloads","issues_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues{/number}","pulls_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/labels{/name}","releases_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/releases{/id}","deployments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/deployments","created_at":"2011-11-28T16:46:32Z","updated_at":"2016-04-15T02:29:34Z","pushed_at":"2016-03-29T13:04:01Z","git_url":"git://github.com/FriendsOfSymfony/FOSOAuthServerBundle.git","ssh_url":"git@github.com:FriendsOfSymfony/FOSOAuthServerBundle.git","clone_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle.git","svn_url":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle","homepage":"","size":579,"stargazers_count":530,"watchers_count":530,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":210,"mirror_url":null,"open_issues_count":105,"forks":210,"open_issues":105,"watchers":530,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405"},"html":{"href":"https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/405"},"issue":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/405"},"comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/issues/405/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405/comments"},"review_comment":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/pulls/405/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfSymfony/FOSOAuthServerBundle/statuses/615c485c4c4e390bef6e44ae51e8c244064e07c4"}}}}