Code Duplication    Length = 5-6 lines in 3 locations

src/Drupal/DrupalExtension/Context/DrupalContext.php 2 locations

@@ 56-61 (lines=6) @@
53
54
      $roles = explode(',', $role);
55
      $roles = array_map('trim', $roles);
56
      foreach ($roles as $role) {
57
        if (!in_array(strtolower($role), array('authenticated', 'authenticated user'))) {
58
          // Only add roles other than 'authenticated user'.
59
          $this->getDriver()->userAddRole($user, $role);
60
        }
61
      }
62
63
      // Login.
64
      $this->login($user);
@@ 96-101 (lines=6) @@
93
94
      $roles = explode(',', $role);
95
      $roles = array_map('trim', $roles);
96
      foreach ($roles as $role) {
97
        if (!in_array(strtolower($role), array('authenticated', 'authenticated user'))) {
98
          // Only add roles other than 'authenticated user'.
99
          $this->getDriver()->userAddRole($user, $role);
100
        }
101
      }
102
103
      // Login.
104
      $this->login($user);

src/Drupal/DrupalExtension/Context/BlockContext.php 1 location

@@ 37-41 (lines=5) @@
34
    $this->userCreate($user);
35
    $roles = explode(',', $role);
36
    $roles = array_map('trim', $roles);
37
    foreach ($roles as $role) {
38
      if (!in_array(strtolower($role), array('authenticated', 'authenticated user'))) {
39
        $this->getDriver()->userAddRole($user, $role);
40
      }
41
    }
42
    $this->login($user);
43
44
    // Go to "admin/structure/blocks".