assertFilteredString example


      // Bug 810824, paragraphs were appearing around iframe tags.       "<iframe>aaa</iframe>\n\n" => [
        "<p><iframe>aaa</iframe></p>" => FALSE,
      ],
      // Bug 3097338, paragraphs were appearing around drupalmedia tags.       '<drupal-media data-caption=" " data-entity-type="media" data-entity-uuid="dbb16f97-cd11-4357-acde-cd09e19e312b"></drupal-media>' => [
        '<p><drupal-media data-caption=" " data-entity-type="media" data-entity-uuid="dbb16f97-cd11-4357-acde-cd09e19e312b"></drupal-media></p>' => FALSE,
      ],
    ];
    // cSpell:enable     $this->assertFilteredString($filter$tests);

    // Very long string hitting PCRE limits.     $limit = max(ini_get('pcre.backtrack_limit')ini_get('pcre.recursion_limit'));
    $source = $this->randomMachineName($limit);
    $result = _filter_autop($source);
    $this->assertEquals($result, '<p>' . $source . "</p>\n", 'Line break filter can process very long strings.');
  }

  /** * Tests filter settings, defaults, access restrictions and similar. * * @todo This is for functions like filter_filter and check_markup, whose * functionality is not completely focused on filtering. Some ideas: * restricting formats according to user permissions, proper cache * handling, defaults -- allowed tags/attributes/protocols. * * @todo It is possible to add script, iframe etc. to allowed tags, but this * makes HTML filter completely ineffective. * * @todo Class, id, name and xmlns should be added to the list of forbidden * attributes, or, better yet, use an allowed attribute list. */
Home | Imprint | This part of the site doesn't use cookies.