GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 8.x-2.x ( 60568e...519fd1 )
by Devin
05:14
created

selectModerationSidebarButton()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 1
dl 13
loc 13
rs 9.4285
1
<?php
2
3
namespace Acquia\DFExtension\Context;
4
5
use Acquia\LightningExtension\AwaitTrait;
6
use Acquia\LightningExtension\Context\PanelsInPlaceContext;
7
use Acquia\LightningExtension\Context\UtilityContext;
8
use Drupal\DrupalExtension\Context\DrupalSubContextBase;
9
10
/**
11
 * A context with miscellaneous helpers.
12
 */
13
class ModerationSidebarContext extends DrupalSubContextBase {
14
15
  use AwaitTrait;
16
17
  /**
18
   * Opens the moderation sidebar.
19
   *
20
   * @When I open the moderation sidebar
21
   */
22 View Code Duplication
  public function openModerationSidebar() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    $assert = $this->assertSession();
24
25
    // Assert that the tab exists...
26
    $link = $assert->elementExists(
27
      'named',
28
      ['link', 'Tasks'],
29
      $assert->elementExists('css', '.moderation-sidebar-toolbar-tab')
30
    );
31
32
    // ...but only open it if not already active.
33
    if ($link->hasClass('sidebar-open') == FALSE) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
34
      $link->click();
35
      $this->awaitAjax();
36
    }
37
  }
38
39
  /**
40
   * Closes the moderation sidebar.
41
   *
42
   * @When I close the moderation sidebar
43
   */
44 View Code Duplication
  public function closeModerationSidebar() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
45
    $assert = $this->assertSession();
46
47
    // Assert that the tab exists...
48
    $link = $assert->elementExists(
49
      'named',
50
      ['link', 'Tasks'],
51
      $assert->elementExists('css', '.moderation-sidebar-toolbar-tab')
52
    );
53
54
    // ...but only open it if already active.
55
    if ($link->hasClass('sidebar-open') == TRUE) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
56
      $link->click();
57
      $this->awaitAjax();
58
    }
59
  }
60
61
  /**
62
   * Selects a moderation sidebar item.
63
   *
64
   * @param string $item
65
   *   The moderation sidebar item to select.
66
   *
67
   * @Given I select the :item moderation sidebar button
68
   */
69 View Code Duplication
  public function selectModerationSidebarButton($item) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
    $assert = $this->assertSession();
71
72
    // Assert that the tab exists...
73
    $link = $assert->elementExists(
74
      'named',
75
      ['button', $item],
76
      $assert->elementExists('css', '.moderation-sidebar-actions')
77
    );
78
79
    $link->click();
80
    $this->awaitAjax();
81
  }
82
83
  /**
84
   * Selects a moderation sidebar item.
85
   *
86
   * @param string $item
87
   *   The moderation sidebar item to select.
88
   *
89
   * @Given I select the :item moderation sidebar link
90
   */
91 View Code Duplication
  public function selectModerationSidebarLink($item) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
92
    $assert = $this->assertSession();
93
94
    // Assert that the tab exists...
95
    $link = $assert->elementExists(
96
      'named',
97
      ['link', $item],
98
      $assert->elementExists('css', '.moderation-sidebar-actions')
99
    );
100
101
    $link->click();
102
    $this->awaitAjax();
103
  }
104
105
}
106
107