Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291378

Bugged tests in the entity error handler?

$
0
0

@sun in #1857376: Provide an area handler that renders an entity:

+++ b/core/modules/views/lib/Drupal/views/Tests/Handler/AreaEntityTest.php

+  public function testEntityArea() {
...
+    $result = $this->xpath('//div[@class = "view-header"]');
+    $this->assertTrue(strpos(trim((string) $result[0]), $entities[0]->label()) !== FALSE, 'The rendered entity appears in the header of the view.');
+    $this->assertTrue(strpos(trim((string) $result[0]), 'full') !== FALSE, 'The rendered entity appeared in the right view mode.');
+
+    $result = $this->xpath('//div[@class = "view-footer"]');
+    $this->assertTrue(strpos(trim((string) $result[0]), $entities[1]->label()) !== FALSE, 'The rendered entity appears in the header of the view.');


+++ b/core/modules/views/tests/views_test_config/test_views/views.view.test_entity_area.yml

+      header:
...
+          entity_id: 1
...
+      footer:
...
+          entity_id: !1

A hidden gem in the footer area entity_id.

Should the tests have passed? Depends on whether entity_test entity IDs are integers, and whether 0 is a valid entity ID.

> php -r "var_dump((int) '!1');"
int(0)

Viewing all articles
Browse latest Browse all 291378

Trending Articles