{"action":"created","comment":{"url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/comments/31127450","id":31127450,"diff_hunk":"@@ -421,4 +468,172 @@ public function testSearchByMoreThanOneStatus()\n             $this->assertContains('New', $res);\n             $this->assertContains('In Progress', $res);\n         }\n+\n+    /**\n+     * Test search by assigned from not admin user.\n+     */\n+        public function testSearchByAssignedFromNotAdminUser()\n+        {\n+            $response_mock = file_get_contents(self::$fixturesPath . 'response_one_issue_assigned_user.serialized');\n+            $current_user_not_admin_mock = file_get_contents(self::$fixturesPath . 'response_current_user_not_admin.serialized');\n+            $user_show_mock = file_get_contents(self::$fixturesPath . 'response_user_show_user_not_admin.serialized');\n+            $membership_all = file_get_contents(self::$fixturesPath . 'response_membership_all_user_not_admin.serialized');\n+\n+            $command = $this->createCommand('redmine:search');\n+            $this->createMocks(\n+                array(\n+                    'redmineApiUserGetCurrentUser' => unserialize($current_user_not_admin_mock),\n+                    'redmineApiIssueAll' => unserialize($response_mock),\n+                    'redmineApiUserShow' => unserialize($user_show_mock),\n+                    'redmineApiMembershipAll' => unserialize($membership_all),\n+                )\n+            );\n+\n+            $input = array(\n+                'command' => $this->command->getName(),\n+                '--project_id' => 'test_project_id',\n+                '--assigned' => 'Paolo Pustorino',\n+                '--fields' => 'id'\n+            );\n+\n+            $this->tester->execute($input);\n+            $res = trim($this->tester->getDisplay());\n+            $expected = <<<EOF\n++------+\n+| ID   |\n++------+\n+| 8921 |\n++------+\n+EOF\n+            ;\n+            $this->assertContains($expected, $res);\n+        }\n+\n+    /**\n+     * Test search by assigned from admin user.\n+     */\n+        public function testSearchByAssignedFromAdminUser()\n+        {\n+            $response_mock = file_get_contents(self::$fixturesPath . 'response_one_issue_assigned_user.serialized');\n+            $current_user_admin_mock = file_get_contents(self::$fixturesPath . 'response_current_user_admin.serialized');\n+            $users_mock = file_get_contents(self::$fixturesPath . 'response_users_user.serialized');\n+\n+            $command = $this->createCommand('redmine:search');\n+            $this->createMocks(\n+                array(\n+                    'redmineApiUserGetCurrentUser' => unserialize($current_user_admin_mock),\n+                    'redmineApiIssueAll' => unserialize($response_mock),\n+                    'redmineApiUserAll' => unserialize($users_mock),\n+                )\n+            );\n+\n+            $input = array(\n+                'command' => $this->command->getName(),\n+                '--project_id' => 'test_project_id',\n+                '--assigned' => 'Paolo Pustorino',\n+                '--fields' => 'id'\n+            );\n+\n+            $this->tester->execute($input);\n+            $res = trim($this->tester->getDisplay());\n+            $expected = <<<EOF\n++------+\n+| ID   |\n++------+\n+| 8921 |\n++------+\n+EOF\n+            ;\n+            $this->assertContains($expected, $res);\n+        }\n+\n+    /**\n+     * Test search by assigned with user id.\n+     */\n+        public function testSearchByAssignedWithUserId()\n+        {\n+            $response_mock = file_get_contents(self::$fixturesPath . 'response_one_issue_assigned_user.serialized');\n+\n+            $command = $this->createCommand('redmine:search');\n+            $this->createMocks(\n+                array(\n+                    'redmineApiIssueAll' => unserialize($response_mock),\n+                )\n+            );\n+\n+            $input = array(\n+                'command' => $this->command->getName(),\n+                '--project_id' => 'test_project_id',\n+                '--assigned' => 1,\n+                '--fields' => 'id'\n+            );\n+\n+            $this->tester->execute($input);\n+            $res = trim($this->tester->getDisplay());\n+            $expected = <<<EOF\n++------+\n+| ID   |\n++------+\n+| 8921 |\n++------+\n+EOF\n+            ;\n+            $this->assertContains($expected, $res);\n+        }\n+\n+    /**\n+     * Test search by wrong assigned user.\n+     */\n+        public function testSearchByAssignedUserNotFound()\n+        {\n+            $response_mock = file_get_contents(self::$fixturesPath . 'response_one_issue_assigned_user.serialized');\n+            $current_user_admin_mock = file_get_contents(self::$fixturesPath . 'response_current_user_admin.serialized');\n+            $users_mock = file_get_contents(self::$fixturesPath . 'response_users_user.serialized');\n+\n+            $command = $this->createCommand('redmine:search');\n+            $this->createMocks(\n+                array(\n+                    'redmineApiUserGetCurrentUser' => unserialize($current_user_admin_mock),\n+                    'redmineApiIssueAll' => unserialize($response_mock),\n+                    'redmineApiUserAll' => unserialize($users_mock),\n+                )\n+            );\n+\n+            $input = array(\n+                'command' => $this->command->getName(),\n+                '--project_id' => 'test_project_id',\n+                '--assigned' => 'WRONG NAME'\n+            );\n+\n+            $this->tester->execute($input);\n+            $res = trim($this->tester->getDisplay());\n+            $expected = \"No user found.\";\n+            $this->assertContains($expected, $res);\n+        }\n+\n+    /**\n+     * Test search by assigned user from not admin user without specify project.\n+     */\n+        public function testSearchByAssignedUserFromNotAdminUserWithoutProjectId()\n+        {\n+            $current_user_not_admin_mock = file_get_contents(self::$fixturesPath . 'response_current_user_not_admin.serialized');\n+\n+            $command = $this->createCommand('redmine:search');\n+            $this->createMocks(\n+                array(\n+                    'redmineApiUserGetCurrentUser' => unserialize($current_user_not_admin_mock),\n+                )\n+            );\n+\n+            $input = array(\n+                'command' => $this->command->getName(),\n+                '--project_id' => '',\n+                '--assigned' => 'Paolo Pustorino'\n+            );\n+\n+            $this->tester->execute($input);\n+            $res = trim($this->tester->getDisplay());\n+            $expected = \"To perform search by assigned user specify the project id.\";\n+            $this->assertContains($expected, $res);","path":"tests/SparkFabrik/Command/Redmine/RedmineSearchCommandTest.php","position":267,"original_position":267,"commit_id":"a05a4a37e4041b8331f4b713b49a4ab503069ee5","original_commit_id":"a05a4a37e4041b8331f4b713b49a4ab503069ee5","user":{"login":"paolomainardi","id":8747,"avatar_url":"https://avatars.githubusercontent.com/u/8747?v=3","gravatar_id":"","url":"https://api.github.com/users/paolomainardi","html_url":"https://github.com/paolomainardi","followers_url":"https://api.github.com/users/paolomainardi/followers","following_url":"https://api.github.com/users/paolomainardi/following{/other_user}","gists_url":"https://api.github.com/users/paolomainardi/gists{/gist_id}","starred_url":"https://api.github.com/users/paolomainardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paolomainardi/subscriptions","organizations_url":"https://api.github.com/users/paolomainardi/orgs","repos_url":"https://api.github.com/users/paolomainardi/repos","events_url":"https://api.github.com/users/paolomainardi/events{/privacy}","received_events_url":"https://api.github.com/users/paolomainardi/received_events","type":"User","site_admin":false},"body":"convert this test using @expectedexception and @excectedexceptionmessage\r\nhttps://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions","created_at":"2015-05-27T12:24:35Z","updated_at":"2015-05-27T12:24:35Z","html_url":"https://github.com/sparkfabrik/sparktool/pull/38#discussion_r31127450","pull_request_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/comments/31127450"},"html":{"href":"https://github.com/sparkfabrik/sparktool/pull/38#discussion_r31127450"},"pull_request":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38","id":36034421,"html_url":"https://github.com/sparkfabrik/sparktool/pull/38","diff_url":"https://github.com/sparkfabrik/sparktool/pull/38.diff","patch_url":"https://github.com/sparkfabrik/sparktool/pull/38.patch","issue_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/38","number":38,"state":"open","locked":false,"title":"refs #18: Redmine - Search: Search users using the membership api for…","user":{"login":"marcopagliarulo","id":3410475,"avatar_url":"https://avatars.githubusercontent.com/u/3410475?v=3","gravatar_id":"","url":"https://api.github.com/users/marcopagliarulo","html_url":"https://github.com/marcopagliarulo","followers_url":"https://api.github.com/users/marcopagliarulo/followers","following_url":"https://api.github.com/users/marcopagliarulo/following{/other_user}","gists_url":"https://api.github.com/users/marcopagliarulo/gists{/gist_id}","starred_url":"https://api.github.com/users/marcopagliarulo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcopagliarulo/subscriptions","organizations_url":"https://api.github.com/users/marcopagliarulo/orgs","repos_url":"https://api.github.com/users/marcopagliarulo/repos","events_url":"https://api.github.com/users/marcopagliarulo/events{/privacy}","received_events_url":"https://api.github.com/users/marcopagliarulo/received_events","type":"User","site_admin":false},"body":"… non-admin users","created_at":"2015-05-22T14:12:00Z","updated_at":"2015-05-27T12:24:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00011204cade73a468831fe523aad83f1578b78e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38/commits","review_comments_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38/comments","review_comment_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/38/comments","statuses_url":"https://api.github.com/repos/sparkfabrik/sparktool/statuses/a05a4a37e4041b8331f4b713b49a4ab503069ee5","head":{"label":"sparkfabrik:feature/ST-18_redmine_search_search_users_using_the_membership_api_for_non_admin_users","ref":"feature/ST-18_redmine_search_search_users_using_the_membership_api_for_non_admin_users","sha":"a05a4a37e4041b8331f4b713b49a4ab503069ee5","user":{"login":"sparkfabrik","id":11347456,"avatar_url":"https://avatars.githubusercontent.com/u/11347456?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkfabrik","html_url":"https://github.com/sparkfabrik","followers_url":"https://api.github.com/users/sparkfabrik/followers","following_url":"https://api.github.com/users/sparkfabrik/following{/other_user}","gists_url":"https://api.github.com/users/sparkfabrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkfabrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkfabrik/subscriptions","organizations_url":"https://api.github.com/users/sparkfabrik/orgs","repos_url":"https://api.github.com/users/sparkfabrik/repos","events_url":"https://api.github.com/users/sparkfabrik/events{/privacy}","received_events_url":"https://api.github.com/users/sparkfabrik/received_events","type":"Organization","site_admin":false},"repo":{"id":36028091,"name":"sparktool","full_name":"sparkfabrik/sparktool","owner":{"login":"sparkfabrik","id":11347456,"avatar_url":"https://avatars.githubusercontent.com/u/11347456?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkfabrik","html_url":"https://github.com/sparkfabrik","followers_url":"https://api.github.com/users/sparkfabrik/followers","following_url":"https://api.github.com/users/sparkfabrik/following{/other_user}","gists_url":"https://api.github.com/users/sparkfabrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkfabrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkfabrik/subscriptions","organizations_url":"https://api.github.com/users/sparkfabrik/orgs","repos_url":"https://api.github.com/users/sparkfabrik/repos","events_url":"https://api.github.com/users/sparkfabrik/events{/privacy}","received_events_url":"https://api.github.com/users/sparkfabrik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sparkfabrik/sparktool","description":"Sparktool CLI","fork":false,"url":"https://api.github.com/repos/sparkfabrik/sparktool","forks_url":"https://api.github.com/repos/sparkfabrik/sparktool/forks","keys_url":"https://api.github.com/repos/sparkfabrik/sparktool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sparkfabrik/sparktool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sparkfabrik/sparktool/teams","hooks_url":"https://api.github.com/repos/sparkfabrik/sparktool/hooks","issue_events_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/events{/number}","events_url":"https://api.github.com/repos/sparkfabrik/sparktool/events","assignees_url":"https://api.github.com/repos/sparkfabrik/sparktool/assignees{/user}","branches_url":"https://api.github.com/repos/sparkfabrik/sparktool/branches{/branch}","tags_url":"https://api.github.com/repos/sparkfabrik/sparktool/tags","blobs_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/refs{/sha}","trees_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sparkfabrik/sparktool/statuses/{sha}","languages_url":"https://api.github.com/repos/sparkfabrik/sparktool/languages","stargazers_url":"https://api.github.com/repos/sparkfabrik/sparktool/stargazers","contributors_url":"https://api.github.com/repos/sparkfabrik/sparktool/contributors","subscribers_url":"https://api.github.com/repos/sparkfabrik/sparktool/subscribers","subscription_url":"https://api.github.com/repos/sparkfabrik/sparktool/subscription","commits_url":"https://api.github.com/repos/sparkfabrik/sparktool/commits{/sha}","git_commits_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/commits{/sha}","comments_url":"https://api.github.com/repos/sparkfabrik/sparktool/comments{/number}","issue_comment_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/comments{/number}","contents_url":"https://api.github.com/repos/sparkfabrik/sparktool/contents/{+path}","compare_url":"https://api.github.com/repos/sparkfabrik/sparktool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sparkfabrik/sparktool/merges","archive_url":"https://api.github.com/repos/sparkfabrik/sparktool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sparkfabrik/sparktool/downloads","issues_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues{/number}","pulls_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls{/number}","milestones_url":"https://api.github.com/repos/sparkfabrik/sparktool/milestones{/number}","notifications_url":"https://api.github.com/repos/sparkfabrik/sparktool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sparkfabrik/sparktool/labels{/name}","releases_url":"https://api.github.com/repos/sparkfabrik/sparktool/releases{/id}","created_at":"2015-05-21T17:43:57Z","updated_at":"2015-05-22T15:56:00Z","pushed_at":"2015-05-27T08:24:43Z","git_url":"git://github.com/sparkfabrik/sparktool.git","ssh_url":"git@github.com:sparkfabrik/sparktool.git","clone_url":"https://github.com/sparkfabrik/sparktool.git","svn_url":"https://github.com/sparkfabrik/sparktool","homepage":null,"size":1172,"stargazers_count":3,"watchers_count":3,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":3,"default_branch":"develop"}},"base":{"label":"sparkfabrik:develop","ref":"develop","sha":"0fd106277f0f874d0a47314de33be931f22df7d5","user":{"login":"sparkfabrik","id":11347456,"avatar_url":"https://avatars.githubusercontent.com/u/11347456?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkfabrik","html_url":"https://github.com/sparkfabrik","followers_url":"https://api.github.com/users/sparkfabrik/followers","following_url":"https://api.github.com/users/sparkfabrik/following{/other_user}","gists_url":"https://api.github.com/users/sparkfabrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkfabrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkfabrik/subscriptions","organizations_url":"https://api.github.com/users/sparkfabrik/orgs","repos_url":"https://api.github.com/users/sparkfabrik/repos","events_url":"https://api.github.com/users/sparkfabrik/events{/privacy}","received_events_url":"https://api.github.com/users/sparkfabrik/received_events","type":"Organization","site_admin":false},"repo":{"id":36028091,"name":"sparktool","full_name":"sparkfabrik/sparktool","owner":{"login":"sparkfabrik","id":11347456,"avatar_url":"https://avatars.githubusercontent.com/u/11347456?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkfabrik","html_url":"https://github.com/sparkfabrik","followers_url":"https://api.github.com/users/sparkfabrik/followers","following_url":"https://api.github.com/users/sparkfabrik/following{/other_user}","gists_url":"https://api.github.com/users/sparkfabrik/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkfabrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkfabrik/subscriptions","organizations_url":"https://api.github.com/users/sparkfabrik/orgs","repos_url":"https://api.github.com/users/sparkfabrik/repos","events_url":"https://api.github.com/users/sparkfabrik/events{/privacy}","received_events_url":"https://api.github.com/users/sparkfabrik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sparkfabrik/sparktool","description":"Sparktool CLI","fork":false,"url":"https://api.github.com/repos/sparkfabrik/sparktool","forks_url":"https://api.github.com/repos/sparkfabrik/sparktool/forks","keys_url":"https://api.github.com/repos/sparkfabrik/sparktool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sparkfabrik/sparktool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sparkfabrik/sparktool/teams","hooks_url":"https://api.github.com/repos/sparkfabrik/sparktool/hooks","issue_events_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/events{/number}","events_url":"https://api.github.com/repos/sparkfabrik/sparktool/events","assignees_url":"https://api.github.com/repos/sparkfabrik/sparktool/assignees{/user}","branches_url":"https://api.github.com/repos/sparkfabrik/sparktool/branches{/branch}","tags_url":"https://api.github.com/repos/sparkfabrik/sparktool/tags","blobs_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/refs{/sha}","trees_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sparkfabrik/sparktool/statuses/{sha}","languages_url":"https://api.github.com/repos/sparkfabrik/sparktool/languages","stargazers_url":"https://api.github.com/repos/sparkfabrik/sparktool/stargazers","contributors_url":"https://api.github.com/repos/sparkfabrik/sparktool/contributors","subscribers_url":"https://api.github.com/repos/sparkfabrik/sparktool/subscribers","subscription_url":"https://api.github.com/repos/sparkfabrik/sparktool/subscription","commits_url":"https://api.github.com/repos/sparkfabrik/sparktool/commits{/sha}","git_commits_url":"https://api.github.com/repos/sparkfabrik/sparktool/git/commits{/sha}","comments_url":"https://api.github.com/repos/sparkfabrik/sparktool/comments{/number}","issue_comment_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues/comments{/number}","contents_url":"https://api.github.com/repos/sparkfabrik/sparktool/contents/{+path}","compare_url":"https://api.github.com/repos/sparkfabrik/sparktool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sparkfabrik/sparktool/merges","archive_url":"https://api.github.com/repos/sparkfabrik/sparktool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sparkfabrik/sparktool/downloads","issues_url":"https://api.github.com/repos/sparkfabrik/sparktool/issues{/number}","pulls_url":"https://api.github.com/repos/sparkfabrik/sparktool/pulls{/number}","milestones_url":"https://api.github.com/repos/sparkfabrik/sparktool/milestones{/number}","notifications_url":"https://api.github.com/repos/sparkfabrik/sparktool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sparkfabrik/sparktool/labels{/name}","releases_url":"https://api.github.com/repos/sparkfabrik/sparktool/releases{/id}","created_at":"2015-05-21T17:43:57Z","updated_at":"2015-05-22T15:56:00Z","pushed_at":"2015-05-27T08:24:43Z","git_url":"git://github.com/sparkfabrik/sparktool.git","ssh_url":"git@github.com:sparkfabrik/sparktool.git","clone_url":"https://github.com/sparkfabrik/sparktool.git","svn_url":"https://github.com/sparkfabrik/sparktool","homepage":null,"size":1172,"stargazers_count":3,"watchers_count":3,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38"},"html":{"href":"https://github.com/sparkfabrik/sparktool/pull/38"},"issue":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/issues/38"},"comments":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/sparkfabrik/sparktool/statuses/a05a4a37e4041b8331f4b713b49a4ab503069ee5"}}}}