diff --git a/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php b/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php index d95b3fb..abb8e23 100644 --- a/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php +++ b/core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php @@ -61,6 +61,7 @@ public function testAttachments() { $this->assertHeader('X-Drupal-Cache', 'HIT'); // Now repeat all of the preceeding using drupal_process_attached(). + debug('Now using drupal_process_attached().'); // Test ['#attached']['http_header] = ['Status', $code]. $this->drupalGet('/render_attached_test/teapot_dpa'); $this->assertResponse(418); @@ -144,8 +145,13 @@ protected function assertFeed() { 'title' => 'Your RSS feed.', ]; $test_meta = reset($test_meta); - foreach ($test_meta->attributes() as $attribute => $value) { - $this->assertEqual($value, $test_meta_attributes[$attribute]); + if (empty($test_meta)) { + $this->fail('Unable to find feed link.'); + } + else { + foreach ($test_meta->attributes() as $attribute => $value) { + $this->assertEqual($value, $test_meta_attributes[$attribute]); + } } } @@ -158,8 +164,13 @@ protected function assertHead() { $this->assertEqual(1, count($test_meta), 'There\'s only one test attribute.'); // Grab the only DOM element. $test_meta = reset($test_meta); - $test_meta_attributes = $test_meta->attributes(); - $this->assertEqual($test_meta_attributes['test-attribute'], 'testy'); + if (empty($test_meta)) { + $this->fail('Unable to find the head meta.'); + } + else { + $test_meta_attributes = $test_meta->attributes(); + $this->assertEqual($test_meta_attributes['test-attribute'], 'testy'); + } } }