Code Duplication    Length = 10-12 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()->string(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-308 (lines=10) @@
296
   *
297
   * @Then I should be able to edit a/an :type( content)
298
   */
299
  public function assertEditNodeOfType($type) {
300
    $node = (object) array('type' => $type);
301
    $saved = $this->nodeCreate($node);
302
303
    // Set internal browser on the node edit page.
304
    $this->getSession()->visit($this->locatePath('/node/' . $saved->nid . '/edit'));
305
306
    // Test status.
307
    $this->assertSession()->statusCodeEquals('200');
308
  }
309
310
311
  /**
@@ 317-328 (lines=12) @@
314
   * @Given I am viewing a/an :vocabulary term with the name :name
315
   * @Given a/an :vocabulary term with the name :name
316
   */
317
  public function createTerm($vocabulary, $name) {
318
    // @todo make this easily extensible.
319
    $term = (object) array(
320
      'name' => $name,
321
      'vocabulary_machine_name' => $vocabulary,
322
      'description' => $this->getRandom()->string(255),
323
    );
324
    $saved = $this->termCreate($term);
325
326
    // Set internal page on the term.
327
    $this->getSession()->visit($this->locatePath('/taxonomy/term/' . $saved->tid));
328
  }
329
330
  /**
331
   * Creates multiple users.