Code Duplication    Length = 11-13 lines in 3 locations

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

@@ 220-230 (lines=11) @@
217
   * @Given I am viewing a/an :type (content )with the title :title
218
   * @Given a/an :type (content )with the title :title
219
   */
220
  public function createNode($type, $title) {
221
    // @todo make this easily extensible.
222
    $node = (object) array(
223
      'title' => $title,
224
      'type' => $type,
225
      'body' => $this->getRandom()->name(255),
226
    );
227
    $saved = $this->nodeCreate($node);
228
    // Set internal page on the new node.
229
    $this->getSession()->visit($this->locatePath('/node/' . $saved->nid));
230
  }
231
232
  /**
233
   * Creates content authored by the current user.
@@ 299-311 (lines=13) @@
296
   *
297
   * @Then I should be able to edit a/an :type( content)
298
   */
299
  public function assertEditNodeOfType($type) {
300
    $node = (object) array(
301
      'type' => $type,
302
      'title' => "Test $type",
303
    );
304
    $saved = $this->nodeCreate($node);
305
306
    // Set internal browser on the node edit page.
307
    $this->getSession()->visit($this->locatePath('/node/' . $saved->nid . '/edit'));
308
309
    // Test status.
310
    $this->assertSession()->statusCodeEquals('200');
311
  }
312
313
314
  /**
@@ 320-331 (lines=12) @@
317
   * @Given I am viewing a/an :vocabulary term with the name :name
318
   * @Given a/an :vocabulary term with the name :name
319
   */
320
  public function createTerm($vocabulary, $name) {
321
    // @todo make this easily extensible.
322
    $term = (object) array(
323
      'name' => $name,
324
      'vocabulary_machine_name' => $vocabulary,
325
      'description' => $this->getRandom()->name(255),
326
    );
327
    $saved = $this->termCreate($term);
328
329
    // Set internal page on the term.
330
    $this->getSession()->visit($this->locatePath('/taxonomy/term/' . $saved->tid));
331
  }
332
333
  /**
334
   * Creates multiple users.