assertParentOption example

$term_5 = array_pop($terms);
    $term_4 = array_pop($terms);

    // Create a term with multiple parents.     $term_6 = $this->createTerm('Test term 6', [
      // Term 5 comes before term 4 in the user interface, so add the parents in       // the matching order.       $term_5->id(),
      $term_4->id(),
    ]);
    $this->drupalGet($term_6->toUrl('edit-form'));
    $this->assertParentOption('<root>');
    $this->assertParentOption('Test term 1');
    $this->assertParentOption('-Test term 3');
    $this->assertParentOption('--Test term 5', TRUE);
    $this->assertParentOption('Test term 2');
    $this->assertParentOption('-Test term 4', TRUE);
    $this->submitForm([], 'Save');
    $this->assertParentsUnchanged($term_6);
  }

  /** * Tests specifying parents when creating terms and a disabled parent form. */
Home | Imprint | This part of the site doesn't use cookies.