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 ( bdb6af...21ed67 )
by Devin
56:27
created

BlockContext::deleteBlock()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Acquia\DFExtension\Context;
4
5
use Drupal\block\Entity\Block;
6
use Drupal\DrupalExtension\Context\DrupalSubContextBase;
7
use Drupal\DrupalExtension\Context\MinkContext;
8
9
/**
10
 * A context for working with blocks and the core block system.
11
 */
12
class BlockContext extends DrupalSubContextBase {
13
14
  /**
15
   * The Mink context.
16
   *
17
   * @var MinkContext
18
   */
19
  protected $minkContext;
20
21
  /**
22
   * Gathers required contexts.
23
   *
24
   * @BeforeScenario
25
   */
26
  public function gatherContexts() {
27
    $this->minkContext = $this->getContext(MinkContext::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getContext(\Drupa...ext\MinkContext::class) of type object<Behat\Behat\Context\Context> or false is incompatible with the declared type object<Drupal\DrupalExte...on\Context\MinkContext> of property $minkContext.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
  }
29
30
  /**
31
   * Instantiates a specific block plugin in a specific theme.
32
   *
33
   * @param string $plugin_id
34
   *   The block plugin ID.
35
   * @param string $theme
36
   *   The theme key.
37
   *
38
   * @When I instantiate the :plugin_id block in :theme
39
   */
40
  public function instantiateBlock($plugin_id, $theme) {
41
    $this->visitPath('/admin/structure/block/add/' . $plugin_id . '/' . $theme);
42
43
    $id = uniqid($theme . '_');
44
    $this->minkContext->fillField('id', $id);
45
46
    /** @var UndoContext $undo */
47
    $undo = $this->getContext(UndoContext::class);
48
    if ($undo) {
49
      $undo->push([$this, 'deleteBlock'], [$id]);
50
    }
51
  }
52
53
  /**
54
   * Deletes a block.
55
   *
56
   * @param string $id
57
   *   The block entity ID.
58
   */
59
  public function deleteBlock($id) {
60
    $block = Block::load($id);
61
    if ($block) {
62
      $block->delete();
63
    }
64
  }
65
66
}
67