Mercurial > hg > isophonics-drupal-site
view core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
line wrap: on
line source
<?php namespace Drupal\FunctionalTests\Breadcrumb; use Drupal\simpletest\BlockCreationTrait; use Drupal\Tests\BrowserTestBase; /** * Tests the breadcrumb of 404 pages. * * @group breadcrumb */ class Breadcrumb404Test extends BrowserTestBase { use BlockCreationTrait; /** * {@inheritdoc} */ public static $modules = ['system', 'block']; /** * Tests that different 404s don't create unnecessary cache entries. */ public function testBreadcrumbOn404Pages() { $this->placeBlock('system_breadcrumb_block', ['id' => 'breadcrumb']); // Prime the cache first. $this->drupalGet('/not-found-1'); $base_count = count($this->getBreadcrumbCacheEntries()); $this->drupalGet('/not-found-2'); $next_count = count($this->getBreadcrumbCacheEntries()); $this->assertEquals($base_count, $next_count); $this->drupalGet('/not-found-3'); $next_count = count($this->getBreadcrumbCacheEntries()); $this->assertEquals($base_count, $next_count); } /** * Gets the breadcrumb cache entries. * * @return array * The breadcrumb cache entries. */ protected function getBreadcrumbCacheEntries() { $database = \Drupal::database(); $cache_entries = $database->select('cache_render') ->fields('cache_render') ->condition('cid', $database->escapeLike('entity_view:block:breadcrumb') . '%', 'LIKE') ->execute() ->fetchAllAssoc('cid'); return $cache_entries; } }