Code Duplication    Length = 11-13 lines in 3 locations

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

@@ 232-242 (lines=11) @@
229
   * @Given I am viewing a/an :type (content )with the title :title
230
   * @Given a/an :type (content )with the title :title
231
   */
232
  public function createNode($type, $title) {
233
    // @todo make this easily extensible.
234
    $node = (object) array(
235
      'title' => $title,
236
      'type' => $type,
237
      'body' => $this->getRandom()->name(255),
238
    );
239
    $saved = $this->nodeCreate($node);
240
    // Set internal page on the new node.
241
    $this->getSession()->visit($this->locatePath('/node/' . $saved->nid));
242
  }
243
244
  /**
245
   * Creates content authored by the current user.
@@ 311-323 (lines=13) @@
308
   *
309
   * @Then I should be able to edit a/an :type( content)
310
   */
311
  public function assertEditNodeOfType($type) {
312
    $node = (object) array(
313
      'type' => $type,
314
      'title' => "Test $type",
315
    );
316
    $saved = $this->nodeCreate($node);
317
318
    // Set internal browser on the node edit page.
319
    $this->getSession()->visit($this->locatePath('/node/' . $saved->nid . '/edit'));
320
321
    // Test status.
322
    $this->assertSession()->statusCodeEquals('200');
323
  }
324
325
326
  /**
@@ 332-343 (lines=12) @@
329
   * @Given I am viewing a/an :vocabulary term with the name :name
330
   * @Given a/an :vocabulary term with the name :name
331
   */
332
  public function createTerm($vocabulary, $name) {
333
    // @todo make this easily extensible.
334
    $term = (object) array(
335
      'name' => $name,
336
      'vocabulary_machine_name' => $vocabulary,
337
      'description' => $this->getRandom()->name(255),
338
    );
339
    $saved = $this->termCreate($term);
340
341
    // Set internal page on the term.
342
    $this->getSession()->visit($this->locatePath('/taxonomy/term/' . $saved->tid));
343
  }
344
345
  /**
346
   * Creates multiple users.