diff --git a/tests/src/Functional/ViewsTest.php b/tests/src/Functional/ViewsTest.php index e72172b8..3c824fd6 100644 --- a/tests/src/Functional/ViewsTest.php +++ b/tests/src/Functional/ViewsTest.php @@ -475,12 +475,14 @@ class ViewsTest extends SearchApiBrowserTestBase { $web_assert = $this->assertSession(); $this->drupalGet('search-api-test-sorts/' . $arguments, ['query' => $query]); - if (isset($expected_results)) { - foreach ($expected_results as $idx => $id) { - $entity_label = Html::escape($this->entities[$id]->label()); - $pos = $idx + 1; - $web_assert->elementContains('xpath', '(//div[contains(@class, "views-row")])[' . $pos . ']', $entity_label); - } + if ($expected_results === NULL) { + return; + } + + foreach ($expected_results as $idx => $id) { + $entity_label = Html::escape($this->entities[$id]->label()); + $pos = $idx + 1; + $web_assert->elementContains('xpath', '(//div[contains(@class, "views-row")])[' . $pos . ']', $entity_label); } }