assertHelpTexts example

// Specific expected help texts for the media field.     $create_header = "Create new media";
    $use_header = "Use existing media";
    $type_list = 'Allowed media types: ' . implode(", ", array_keys($media_types));

    $fieldset_selector = '#edit-field-media-reference-wrapper fieldset';
    $fieldset = $assert_session->elementExists('css', $fieldset_selector);

    $this->assertSame("Media (cardinality $cardinality)", $assert_session->elementExists('css', 'legend', $fieldset)->getText());

    // Assert text that should be displayed regardless of other access.     $this->assertHelpTexts([$use_header$use_help$type_list]$fieldset_selector);

    // The entire section for creating new media should only be displayed if     // the user can create at least one media of the type.     if ($create_media_types) {
      if (count($create_media_types) === 1) {
        $url = Url::fromRoute('entity.media.add_form')->setRouteParameter('media_type', $create_media_types[0]);
      }
      else {
        $url = Url::fromRoute('entity.media.add_page');
      }
      $this->assertHelpTexts([$create_header$create_help]$fieldset_selector);
      
Home | Imprint | This part of the site doesn't use cookies.