Commit 9456f5e2 authored by Thomas Seidl's avatar Thomas Seidl
Browse files

Issue #3358819 by drunken monkey: Fixed tests against Drupal 10.1.

parent 865c1b5e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
Search API 1.x, dev (xxxx-xx-xx):
---------------------------------
- #3358819 by drunken monkey: Fixed tests against Drupal 10.1.
- #3356817 by Eduardo Morales Alberti, drunken monkey: Adapted phrasing of
  warning in SearchApiFulltext to that of Core.
- #3358661 by drunken monkey, tobiasb: Fixed coding standards.
+6 −2
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ class RenderedItemTest extends ProcessorTestBase {
      // Test that the value is properly wrapped in a
      // \Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface
      // object, which contains a string (not, for example, some markup object).
      $this->assertInstanceOf('Drupal\search_api\Plugin\search_api\data_type\value\TextValueInterface', $values[0], "$type item $entity_id rendered value is properly wrapped in a text value object.");
      $this->assertInstanceOf(TextValueInterface::class, $values[0], "$type item $entity_id rendered value is properly wrapped in a text value object.");
      $field_value = $values[0]->getText();
      $this->assertIsString($field_value, "$type item $entity_id rendered value is a string.");
      $this->assertEquals(1, count($values), "$type item $entity_id rendered value is a single value.");
@@ -281,7 +281,11 @@ class RenderedItemTest extends ProcessorTestBase {
    // when the processor was broken, because the schema metadata was also
    // adding it to the output.
    $nid = $node->id();
    $this->assertStringContainsString('<article role="article">', $field_value, 'Node item ' . $nid . ' not rendered in theme Stable.');
    // The role="article" ARIA attribute was removed in Drupal 10.1. To be able
    // to run this test both against earlier and later versions of Drupal Core,
    // we need to use a regular expression.
    // @todo Change to check only for "<article>" once we depend on Drupal 10.1.
    $this->assertMatchesRegularExpression('#<article(?: role="article")?>#', $field_value, 'Node item ' . $nid . ' not rendered in theme Stable.');
    if ($node->bundle() === 'page') {
      $this->assertStringNotContainsString('>Read more<', $field_value, 'Node item ' . $nid . " rendered in view-mode \"full\".");
      $this->assertStringContainsString('>' . $node->get('body')->getValue()[0]['value'] . '<', $field_value, 'Node item ' . $nid . ' does not have rendered body inside HTML-Tags.');