{"action":"created","comment":{"url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/comments/96133214","pull_request_review_id":16710420,"id":96133214,"diff_hunk":"@@ -0,0 +1,203 @@\n+<?php\n+/**\n+ * @file\n+ * Contains \\Drupal\\nexteuropa\\Context\\FieldContext.\n+ */\n+\n+namespace Drupal\\nexteuropa\\Context;\n+\n+use Behat\\Behat\\Context\\Context;\n+use Behat\\Gherkin\\Node\\TableNode;\n+\n+/**\n+ * Context with content type management.\n+ */\n+class ContentTypeContext implements Context {\n+\n+  /**\n+   * The list of node type before a scenario starts.\n+   *\n+   * @var array\n+   */\n+  protected $defaultNodeTypes = array();\n+\n+  /**\n+   * Remember the list of node type.\n+   *\n+   * @BeforeScenario\n+   */\n+  public function rememberCurrentNodeTypes() {\n+    foreach (node_type_get_types() as $result) {\n+      $this->defaultNodeTypes[$result->type] = $result->type;\n+    }\n+  }\n+\n+  /**\n+   * Removes any node types created after the last list node type remembered.\n+   *\n+   * @AfterScenario\n+   */\n+  public function resetNodeTypes() {\n+    if (empty($this->defaultNodeTypes)) {\n+      return;\n+    }\n+\n+    foreach (node_type_get_types() as $result) {\n+      if (!in_array($result->type, $this->defaultNodeTypes)) {\n+        node_type_delete($result->type);\n+      }\n+    }\n+    $this->defaultNodeTypes = array();\n+  }\n+\n+  /**\n+   * Add a field to a specified content type.\n+   *\n+   * @param string $arg1\n+   *    The machine name of the content type to which attaching the field.\n+   * @param TableNode $settings\n+   *    Two columns table containing field settings.\n+   *\n+   * @Given a field with the following settings is added to the :arg1 type:\n+   *\n+   * @throws \\InvalidArgumentException\n+   *    If the field exist already in the Drupal system.\n+   */\n+  public function aFieldWithTheFollowingSettingsIsAddedToTheType($arg1, TableNode $settings) {\n+    $field_info = array();\n+    $field_instance_info = array();\n+\n+    $field_instance_info['entity_type'] = 'node';\n+    $field_instance_info['bundle'] = $arg1;\n+\n+    // Assign fields to user before creation.\n+    foreach ($settings->getRowsHash() as $setting_name => $value) {\n+      switch ($setting_name) {\n+        case 'Label':\n+          $field_instance_info['label'] = $value;\n+          break;\n+\n+        case 'Name':\n+          $field_name = 'field_' . $value;\n+          $is_field_exiting = field_info_field($field_name);\n+          if ($is_field_exiting) {\n+            throw new \\InvalidArgumentException(sprintf('The field \"%s\" already exists and cannot be used for test purpose.', $setting_name));\n+          }\n+          $field_info['field_name'] = $field_name;\n+          $field_instance_info['field_name'] = $field_name;\n+          break;\n+\n+        case 'Type':\n+          $field_info['type'] = $value;\n+          break;\n+\n+        case 'Cardinality':\n+          $field_info['cardinality'] = ($value == \"unlimited\") ? -1 : $value;\n+          break;\n+\n+        case 'Widget':\n+          $field_instance_info['widget']['type'] = $value;\n+          break;\n+\n+        case 'Allowed values':\n+          $values = explode('::', $value);\n+          foreach ($values as $allowed_value) {\n+            $allowed_option = $allowed_value;\n+            $allowed_label = $allowed_value;\n+            $parsed_value = explode('>', $allowed_value);\n+            if (count($parsed_value) == 2) {\n+              $allowed_option = $parsed_value[0];\n+              $allowed_label = $parsed_value[1];\n+            }\n+            $allowed_values[$allowed_option] = $allowed_label;\n+          }\n+          $field_info['settings']['allowed_values'] = $allowed_values;\n+          break;\n+\n+        case 'Translatable':\n+          $field_info['translatable'] = (bool) $value;\n+          break;\n+\n+        case 'Default values':\n+          break;\n+\n+        case 'description':\n+          $field_instance_info['label'] = $value;\n+          break;\n+\n+        case 'Required':\n+          $field_instance_info['required'] = (bool) $value;\n+          break;\n+      }\n+    }\n+    field_create_field($field_info);\n+    field_create_instance($field_instance_info);\n+  }\n+\n+  /**\n+   * Add a field group in the content type view and assign fields as children.\n+   *\n+   * @param string $arg1\n+   *    The machine name of the content type to which attaching the field.\n+   * @param TableNode $settings\n+   *    Two columns table containing field settings.\n+   *\n+   * @Given a field group with the following settings is added to the :arg1 type view:\n+   */\n+  public function aFieldGroupWithTheFollowingSettingsIsAddedToTheTypeView($arg1, TableNode $settings) {\n+    $group_machine_type = 'fieldset';\n+    $mode = 'default';\n+    $group_children = array();\n+    // TODO : implement the fully support of the group type, missing","path":"tests/src/Context/ContentTypeContext.php","position":151,"original_position":151,"commit_id":"7e01649626b6e4c8160fb684187227a65d5c86f2","original_commit_id":"7e01649626b6e4c8160fb684187227a65d5c86f2","user":{"login":"gillesdeudon","id":8696408,"avatar_url":"https://avatars.githubusercontent.com/u/8696408?v=3","gravatar_id":"","url":"https://api.github.com/users/gillesdeudon","html_url":"https://github.com/gillesdeudon","followers_url":"https://api.github.com/users/gillesdeudon/followers","following_url":"https://api.github.com/users/gillesdeudon/following{/other_user}","gists_url":"https://api.github.com/users/gillesdeudon/gists{/gist_id}","starred_url":"https://api.github.com/users/gillesdeudon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gillesdeudon/subscriptions","organizations_url":"https://api.github.com/users/gillesdeudon/orgs","repos_url":"https://api.github.com/users/gillesdeudon/repos","events_url":"https://api.github.com/users/gillesdeudon/events{/privacy}","received_events_url":"https://api.github.com/users/gillesdeudon/received_events","type":"User","site_admin":false},"body":"I will not because that it is easier to work on this method while working on concrete cases, and adding a new element in it when it is necessary.\r\n\r\nThe todo comment is there for just reminding the method is fully implemented and we are aware  of it.","created_at":"2017-01-15T09:14:52Z","updated_at":"2017-01-15T09:14:52Z","html_url":"https://github.com/ec-europa/platform-dev/pull/1132#discussion_r96133214","pull_request_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132","_links":{"self":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/comments/96133214"},"html":{"href":"https://github.com/ec-europa/platform-dev/pull/1132#discussion_r96133214"},"pull_request":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132"}}},"pull_request":{"url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132","id":100250493,"html_url":"https://github.com/ec-europa/platform-dev/pull/1132","diff_url":"https://github.com/ec-europa/platform-dev/pull/1132.diff","patch_url":"https://github.com/ec-europa/platform-dev/pull/1132.patch","issue_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/1132","number":1132,"state":"open","locked":false,"title":"Nept 225 : refactore field.multilingual.feature ","user":{"login":"gillesdeudon","id":8696408,"avatar_url":"https://avatars.githubusercontent.com/u/8696408?v=3","gravatar_id":"","url":"https://api.github.com/users/gillesdeudon","html_url":"https://github.com/gillesdeudon","followers_url":"https://api.github.com/users/gillesdeudon/followers","following_url":"https://api.github.com/users/gillesdeudon/following{/other_user}","gists_url":"https://api.github.com/users/gillesdeudon/gists{/gist_id}","starred_url":"https://api.github.com/users/gillesdeudon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gillesdeudon/subscriptions","organizations_url":"https://api.github.com/users/gillesdeudon/orgs","repos_url":"https://api.github.com/users/gillesdeudon/repos","events_url":"https://api.github.com/users/gillesdeudon/events{/privacy}","received_events_url":"https://api.github.com/users/gillesdeudon/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-05T08:25:11Z","updated_at":"2017-01-15T09:14:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07c0703743e17a5bf73a9a65fb24f2e262bb6085","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132/commits","review_comments_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132/comments","review_comment_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/1132/comments","statuses_url":"https://api.github.com/repos/ec-europa/platform-dev/statuses/7e01649626b6e4c8160fb684187227a65d5c86f2","head":{"label":"ec-europa:nept-225","ref":"nept-225","sha":"7e01649626b6e4c8160fb684187227a65d5c86f2","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars.githubusercontent.com/u/10885565?v=3","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":41666809,"name":"platform-dev","full_name":"ec-europa/platform-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars.githubusercontent.com/u/10885565?v=3","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/platform-dev","description":"NextEuropa platform","fork":false,"url":"https://api.github.com/repos/ec-europa/platform-dev","forks_url":"https://api.github.com/repos/ec-europa/platform-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/platform-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/platform-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/platform-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/platform-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/platform-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/platform-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/platform-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/platform-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/platform-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/platform-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/platform-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/platform-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/platform-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/platform-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/platform-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/platform-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/platform-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/platform-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/platform-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/platform-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/platform-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/platform-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/platform-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/platform-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/platform-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/platform-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/platform-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/platform-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/platform-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/platform-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/platform-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/platform-dev/deployments","created_at":"2015-08-31T09:16:12Z","updated_at":"2016-12-20T14:00:49Z","pushed_at":"2017-01-13T17:30:57Z","git_url":"git://github.com/ec-europa/platform-dev.git","ssh_url":"git@github.com:ec-europa/platform-dev.git","clone_url":"https://github.com/ec-europa/platform-dev.git","svn_url":"https://github.com/ec-europa/platform-dev","homepage":null,"size":48123,"stargazers_count":27,"watchers_count":27,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":48,"forks":26,"open_issues":48,"watchers":27,"default_branch":"master"}},"base":{"label":"ec-europa:release/2.3","ref":"release/2.3","sha":"33d4820f6b42340961de3551e81f2009de593712","user":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars.githubusercontent.com/u/10885565?v=3","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":41666809,"name":"platform-dev","full_name":"ec-europa/platform-dev","owner":{"login":"ec-europa","id":10885565,"avatar_url":"https://avatars.githubusercontent.com/u/10885565?v=3","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/platform-dev","description":"NextEuropa platform","fork":false,"url":"https://api.github.com/repos/ec-europa/platform-dev","forks_url":"https://api.github.com/repos/ec-europa/platform-dev/forks","keys_url":"https://api.github.com/repos/ec-europa/platform-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ec-europa/platform-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ec-europa/platform-dev/teams","hooks_url":"https://api.github.com/repos/ec-europa/platform-dev/hooks","issue_events_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/events{/number}","events_url":"https://api.github.com/repos/ec-europa/platform-dev/events","assignees_url":"https://api.github.com/repos/ec-europa/platform-dev/assignees{/user}","branches_url":"https://api.github.com/repos/ec-europa/platform-dev/branches{/branch}","tags_url":"https://api.github.com/repos/ec-europa/platform-dev/tags","blobs_url":"https://api.github.com/repos/ec-europa/platform-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ec-europa/platform-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ec-europa/platform-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/ec-europa/platform-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ec-europa/platform-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/ec-europa/platform-dev/languages","stargazers_url":"https://api.github.com/repos/ec-europa/platform-dev/stargazers","contributors_url":"https://api.github.com/repos/ec-europa/platform-dev/contributors","subscribers_url":"https://api.github.com/repos/ec-europa/platform-dev/subscribers","subscription_url":"https://api.github.com/repos/ec-europa/platform-dev/subscription","commits_url":"https://api.github.com/repos/ec-europa/platform-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/ec-europa/platform-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/ec-europa/platform-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/ec-europa/platform-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/ec-europa/platform-dev/contents/{+path}","compare_url":"https://api.github.com/repos/ec-europa/platform-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ec-europa/platform-dev/merges","archive_url":"https://api.github.com/repos/ec-europa/platform-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ec-europa/platform-dev/downloads","issues_url":"https://api.github.com/repos/ec-europa/platform-dev/issues{/number}","pulls_url":"https://api.github.com/repos/ec-europa/platform-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/ec-europa/platform-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/ec-europa/platform-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ec-europa/platform-dev/labels{/name}","releases_url":"https://api.github.com/repos/ec-europa/platform-dev/releases{/id}","deployments_url":"https://api.github.com/repos/ec-europa/platform-dev/deployments","created_at":"2015-08-31T09:16:12Z","updated_at":"2016-12-20T14:00:49Z","pushed_at":"2017-01-13T17:30:57Z","git_url":"git://github.com/ec-europa/platform-dev.git","ssh_url":"git@github.com:ec-europa/platform-dev.git","clone_url":"https://github.com/ec-europa/platform-dev.git","svn_url":"https://github.com/ec-europa/platform-dev","homepage":null,"size":48123,"stargazers_count":27,"watchers_count":27,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":48,"forks":26,"open_issues":48,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132"},"html":{"href":"https://github.com/ec-europa/platform-dev/pull/1132"},"issue":{"href":"https://api.github.com/repos/ec-europa/platform-dev/issues/1132"},"comments":{"href":"https://api.github.com/repos/ec-europa/platform-dev/issues/1132/comments"},"review_comments":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132/comments"},"review_comment":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ec-europa/platform-dev/pulls/1132/commits"},"statuses":{"href":"https://api.github.com/repos/ec-europa/platform-dev/statuses/7e01649626b6e4c8160fb684187227a65d5c86f2"}}}}
{"actor":{"display_login":"gillesdeudon"}}