{"action":"created","comment":{"url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments/168523471","pull_request_review_id":96905220,"id":168523471,"diff_hunk":"@@ -22,6 +27,69 @@ class JoinupInviteSubContext extends DrupalSubContextBase implements DrupalSubCo\n \n   use NodeTrait;\n   use UserTrait;\n+  use RdfEntityTrait;\n+\n+  /**\n+   * Asserts that the user has an invitation in the given group.\n+   *\n+   * @param string $user\n+   *   The user name.\n+   * @param string $status\n+   *   The invitation status.\n+   * @param string $label\n+   *   The group label.\n+   * @param string $type\n+   *   The group type.\n+   *\n+   * @throws \\Exception\n+   *   Thrown when an invalid status is requested or the requested invitation\n+   *   is not found.\n+   *\n+   * @Then :user should have a(n) :status invitation in the :label :type\n+   */\n+  public function userShouldBeInvitedToGroup($user, $status, $label, $type) {\n+    $statuses = [\n+      'accepted' => InvitationInterface::STATUS_ACCEPTED,\n+      'pending' => InvitationInterface::STATUS_PENDING,\n+    ];\n+    if (!in_array($status, array_keys($statuses))) {\n+      throw new Exception('Only the following statuses are allowed: ' . implode(', ', array_keys($statuses)));\n+    }\n+    $user = $this->getUserByName($user);\n+    $group = $this->getRdfEntityByLabel($label, $type);\n+    $invitation_info = $this->getInvitationInfo($type);\n+    $invitation = $this->loadByEntityAndUserUnchanged($group, $user, $invitation_info['invitation_bundle']);\n+    if (empty($invitation)) {\n+      throw new Exception(\"No invitation was found for {$user->getAccountName()} in the \\\"{$group->label()}\\\" {$group->bundle()}\");\n+    }\n+    PHPUnit_Framework_Assert::assertEquals($invitation->getStatus(), $statuses[$status]);\n+  }\n+\n+  /**\n+   * Asserts that there is no invitation for the given user and group.\n+   *\n+   * @param string $user\n+   *   The user name.\n+   * @param string $label\n+   *   The group label.\n+   * @param string $type\n+   *   The group type.\n+   *\n+   * @throws \\Exception\n+   *   Thrown when an invalid status is requested or the requested invitation\n+   *   is not found.\n+   *\n+   * @Then no invitation should exist for the user :user in the :label :type\n+   */\n+  public function assertNoInvitation($user, $label, $type) {\n+    $user = $this->getUserByName($user);\n+    $group = $this->getRdfEntityByLabel($label, $type);\n+    $invitation_info = $this->getInvitationInfo($type);\n+    $invitation = Invitation::loadByEntityAndUser($group, $user, $invitation_info['invitation_bundle']);\n+    if (!empty($invitation)) {\n+      throw new Exception(\"An invitation was found for {$user->getAccountName()} in the \\\"{$group->label()}\\\" {$group->bundle()}\");","path":"web/modules/custom/joinup_invite/joinup_invite.behat.inc","position":82,"original_position":82,"commit_id":"fb0b9c0a1b67b89469aceabb483f67aa64f07470","original_commit_id":"31def4d7067bbeac00a0d764923b140b969b8c6c","user":{"login":"claudiu-cristea","id":473868,"avatar_url":"https://avatars0.githubusercontent.com/u/473868?v=4","gravatar_id":"","url":"https://api.github.com/users/claudiu-cristea","html_url":"https://github.com/claudiu-cristea","followers_url":"https://api.github.com/users/claudiu-cristea/followers","following_url":"https://api.github.com/users/claudiu-cristea/following{/other_user}","gists_url":"https://api.github.com/users/claudiu-cristea/gists{/gist_id}","starred_url":"https://api.github.com/users/claudiu-cristea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudiu-cristea/subscriptions","organizations_url":"https://api.github.com/users/claudiu-cristea/orgs","repos_url":"https://api.github.com/users/claudiu-cristea/repos","events_url":"https://api.github.com/users/claudiu-cristea/events{/privacy}","received_events_url":"https://api.github.com/users/claudiu-cristea/received_events","type":"User","site_admin":false},"body":"I was misunderstood I'm referring to the inner double-quotes. Replacing them with single quotes would avoid escaping. Not a big deal, anyway - just for fanciness :)","created_at":"2018-02-15T16:09:26Z","updated_at":"2018-02-15T16:09:26Z","html_url":"https://github.com/ec-europa/joinup-dev/pull/1086#discussion_r168523471","pull_request_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments/168523471"},"html":{"href":"https://github.com/ec-europa/joinup-dev/pull/1086#discussion_r168523471"},"pull_request":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086"}},"in_reply_to_id":168102223},"pull_request":{"url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086","id":168429808,"html_url":"https://github.com/ec-europa/joinup-dev/pull/1086","diff_url":"https://github.com/ec-europa/joinup-dev/pull/1086.diff","patch_url":"https://github.com/ec-europa/joinup-dev/pull/1086.patch","issue_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/1086","number":1086,"state":"open","locked":false,"title":"4219: Receive invitations to invite a collection","user":{"login":"idimopoulos","id":12171851,"avatar_url":"https://avatars3.githubusercontent.com/u/12171851?v=4","gravatar_id":"","url":"https://api.github.com/users/idimopoulos","html_url":"https://github.com/idimopoulos","followers_url":"https://api.github.com/users/idimopoulos/followers","following_url":"https://api.github.com/users/idimopoulos/following{/other_user}","gists_url":"https://api.github.com/users/idimopoulos/gists{/gist_id}","starred_url":"https://api.github.com/users/idimopoulos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idimopoulos/subscriptions","organizations_url":"https://api.github.com/users/idimopoulos/orgs","repos_url":"https://api.github.com/users/idimopoulos/repos","events_url":"https://api.github.com/users/idimopoulos/events{/privacy}","received_events_url":"https://api.github.com/users/idimopoulos/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-11T01:02:31Z","updated_at":"2018-02-15T16:09:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d2c406f044264ae2fc4606079eae42acf6f86aa4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086/commits","review_comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086/comments","review_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/1086/comments","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/fb0b9c0a1b67b89469aceabb483f67aa64f07470","head":{"label":"ec-europa:ISAICP-4219","ref":"ISAICP-4219","sha":"fb0b9c0a1b67b89469aceabb483f67aa64f07470","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars1.githubusercontent.com/u/10885565?v=4","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"repo":{"id":46046597,"name":"joinup-dev","full_name":"ec-europa/joinup-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars1.githubusercontent.com/u/10885565?v=4","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ec-europa/joinup-dev","description":"Joinup Drupal 8 development","fork":false,"url":"https://api.github.com/repos/ec-europa/joinup-dev","forks_url":"https://api.github.com/repos/ec-europa/joinup-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/joinup-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/joinup-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/joinup-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/joinup-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/joinup-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/joinup-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/joinup-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/joinup-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/joinup-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/joinup-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/joinup-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/joinup-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/joinup-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/joinup-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/joinup-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/joinup-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/joinup-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/joinup-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/joinup-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/joinup-dev/deployments","created_at":"2015-11-12T10:46:34Z","updated_at":"2018-02-13T10:04:03Z","pushed_at":"2018-02-15T16:03:23Z","git_url":"git://github.com/ec-europa/joinup-dev.git","ssh_url":"git@github.com:ec-europa/joinup-dev.git","clone_url":"https://github.com/ec-europa/joinup-dev.git","svn_url":"https://github.com/ec-europa/joinup-dev","homepage":null,"size":202436,"stargazers_count":16,"watchers_count":16,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":9,"open_issues":29,"watchers":16,"default_branch":"develop"}},"base":{"label":"ec-europa:EPIC/ISAICP-4205","ref":"EPIC/ISAICP-4205","sha":"5a7e9f09478e6536170598a66f63f903774df9f5","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars1.githubusercontent.com/u/10885565?v=4","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"repo":{"id":46046597,"name":"joinup-dev","full_name":"ec-europa/joinup-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars1.githubusercontent.com/u/10885565?v=4","gravatar_id":"","url":"https://api.github.com/users/ec-europa","html_url":"https://github.com/ec-europa","followers_url":"https://api.github.com/users/ec-europa/followers","following_url":"https://api.github.com/users/ec-europa/following{/other_user}","gists_url":"https://api.github.com/users/ec-europa/gists{/gist_id}","starred_url":"https://api.github.com/users/ec-europa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ec-europa/subscriptions","organizations_url":"https://api.github.com/users/ec-europa/orgs","repos_url":"https://api.github.com/users/ec-europa/repos","events_url":"https://api.github.com/users/ec-europa/events{/privacy}","received_events_url":"https://api.github.com/users/ec-europa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ec-europa/joinup-dev","description":"Joinup Drupal 8 development","fork":false,"url":"https://api.github.com/repos/ec-europa/joinup-dev","forks_url":"https://api.github.com/repos/ec-europa/joinup-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/joinup-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/joinup-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/joinup-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/joinup-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/joinup-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/joinup-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/joinup-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/joinup-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/joinup-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/joinup-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/joinup-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/joinup-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/joinup-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/joinup-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/joinup-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/joinup-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/joinup-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/joinup-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/joinup-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/joinup-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/joinup-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/joinup-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/joinup-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/joinup-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/joinup-dev/deployments","created_at":"2015-11-12T10:46:34Z","updated_at":"2018-02-13T10:04:03Z","pushed_at":"2018-02-15T16:03:23Z","git_url":"git://github.com/ec-europa/joinup-dev.git","ssh_url":"git@github.com:ec-europa/joinup-dev.git","clone_url":"https://github.com/ec-europa/joinup-dev.git","svn_url":"https://github.com/ec-europa/joinup-dev","homepage":null,"size":202436,"stargazers_count":16,"watchers_count":16,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":9,"open_issues":29,"watchers":16,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086"},"html":{"href":"https://github.com/ec-europa/joinup-dev/pull/1086"},"issue":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/issues/1086"},"comments":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/issues/1086/comments"},"review_comments":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086/comments"},"review_comment":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/pulls/1086/commits"},"statuses":{"href":"https://api.github.com/repos/ec-europa/joinup-dev/statuses/fb0b9c0a1b67b89469aceabb483f67aa64f07470"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"claudiu-cristea"}}