Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5
This commit is contained in:
parent
13b6ca7cc2
commit
38ba7c357d
342 changed files with 7814 additions and 1534 deletions
|
@ -13,7 +13,7 @@ class AdminController extends ControllerBase {
|
|||
* Prints a listing of admin tasks, organized by module.
|
||||
*
|
||||
* @return array
|
||||
* A render array containing the listing.
|
||||
* A render array containing the listing.
|
||||
*/
|
||||
public function index() {
|
||||
$module_info = system_get_info('module');
|
||||
|
|
|
@ -394,7 +394,7 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
|||
* Returns the message to be displayed when there are no selected items.
|
||||
*
|
||||
* @return string
|
||||
* Message displayed when no items are selected.
|
||||
* Message displayed when no items are selected.
|
||||
*/
|
||||
protected function emptySelectedMessage() {
|
||||
return $this->t('No items selected.');
|
||||
|
|
|
@ -9,7 +9,7 @@ use Drupal\Core\Cache\ApcuBackend;
|
|||
* Tests the APCu cache backend.
|
||||
*
|
||||
* @group Cache
|
||||
* @requires extension apc
|
||||
* @requires extension apcu
|
||||
*/
|
||||
class ApcuBackendUnitTest extends GenericCacheBackendUnitTestBase {
|
||||
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\system\Tests\DrupalKernel;
|
||||
|
||||
use Drupal\Core\DrupalKernel;
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Tests DIC compilation to disk.
|
||||
*
|
||||
* @group DrupalKernel
|
||||
*/
|
||||
class DrupalKernelTest extends KernelTestBase {
|
||||
|
||||
protected function setUp() {
|
||||
// DrupalKernel relies on global $config_directories and requires those
|
||||
// directories to exist. Therefore, create the directories, but do not
|
||||
// invoke KernelTestBase::setUp(), since that would set up further
|
||||
// environment aspects, which would distort this test, because it tests
|
||||
// the DrupalKernel (re-)building itself.
|
||||
$this->prepareConfigDirectories();
|
||||
|
||||
$this->settingsSet('php_storage', array('service_container' => array(
|
||||
'bin' => 'service_container',
|
||||
'class' => 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage',
|
||||
'directory' => DRUPAL_ROOT . '/' . $this->publicFilesDirectory . '/php',
|
||||
'secret' => Settings::getHashSalt(),
|
||||
)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function prepareConfigDirectories() {
|
||||
\Drupal::setContainer($this->originalContainer);
|
||||
parent::prepareConfigDirectories();
|
||||
\Drupal::unsetContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a kernel for testings.
|
||||
*
|
||||
* Because the bootstrap is in DrupalKernel::boot and that involved loading
|
||||
* settings from the filesystem we need to go to extra lengths to build a kernel
|
||||
* for testing.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* A request object to use in booting the kernel.
|
||||
* @param array $modules_enabled
|
||||
* A list of modules to enable on the kernel.
|
||||
*
|
||||
* @return \Drupal\Core\DrupalKernel
|
||||
* New kernel for testing.
|
||||
*/
|
||||
protected function getTestKernel(Request $request, array $modules_enabled = NULL) {
|
||||
// Manually create kernel to avoid replacing settings.
|
||||
$class_loader = require DRUPAL_ROOT . '/autoload.php';
|
||||
$kernel = DrupalKernel::createFromRequest($request, $class_loader, 'testing');
|
||||
$this->settingsSet('container_yamls', []);
|
||||
$this->settingsSet('hash_salt', $this->databasePrefix);
|
||||
if (isset($modules_enabled)) {
|
||||
$kernel->updateModules($modules_enabled);
|
||||
}
|
||||
$kernel->boot();
|
||||
|
||||
return $kernel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests DIC compilation.
|
||||
*/
|
||||
public function testCompileDIC() {
|
||||
// @todo: write a memory based storage backend for testing.
|
||||
$modules_enabled = array(
|
||||
'system' => 'system',
|
||||
'user' => 'user',
|
||||
);
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
$this->getTestKernel($request, $modules_enabled);
|
||||
|
||||
// Instantiate it a second time and we should get the compiled Container
|
||||
// class.
|
||||
$kernel = $this->getTestKernel($request);
|
||||
$container = $kernel->getContainer();
|
||||
$refClass = new \ReflectionClass($container);
|
||||
$is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$this->assertTrue($is_compiled_container);
|
||||
// Verify that the list of modules is the same for the initial and the
|
||||
// compiled container.
|
||||
$module_list = array_keys($container->get('module_handler')->getModuleList());
|
||||
$this->assertEqual(array_values($modules_enabled), $module_list);
|
||||
|
||||
// Get the container another time, simulating a "production" environment.
|
||||
$container = $this->getTestKernel($request, NULL)
|
||||
->getContainer();
|
||||
|
||||
$refClass = new \ReflectionClass($container);
|
||||
$is_compiled_container = !$refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$this->assertTrue($is_compiled_container);
|
||||
|
||||
// Verify that the list of modules is the same for the initial and the
|
||||
// compiled container.
|
||||
$module_list = array_keys($container->get('module_handler')->getModuleList());
|
||||
$this->assertEqual(array_values($modules_enabled), $module_list);
|
||||
|
||||
// Test that our synthetic services are there.
|
||||
$class_loader = $container->get('class_loader');
|
||||
$refClass = new \ReflectionClass($class_loader);
|
||||
$this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a class loader');
|
||||
|
||||
// We make this assertion here purely to show that the new container below
|
||||
// is functioning correctly, i.e. we get a brand new ContainerBuilder
|
||||
// which has the required new services, after changing the list of enabled
|
||||
// modules.
|
||||
$this->assertFalse($container->has('service_provider_test_class'));
|
||||
|
||||
// Add another module so that we can test that the new module's bundle is
|
||||
// registered to the new container.
|
||||
$modules_enabled['service_provider_test'] = 'service_provider_test';
|
||||
$this->getTestKernel($request, $modules_enabled);
|
||||
|
||||
// Instantiate it a second time and we should not get a ContainerBuilder
|
||||
// class because we are loading the container definition from cache.
|
||||
$kernel = $this->getTestKernel($request, $modules_enabled);
|
||||
$container = $kernel->getContainer();
|
||||
|
||||
$refClass = new \ReflectionClass($container);
|
||||
$is_container_builder = $refClass->isSubclassOf('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||
$this->assertFalse($is_container_builder, 'Container is not a builder');
|
||||
|
||||
// Assert that the new module's bundle was registered to the new container.
|
||||
$this->assertTrue($container->has('service_provider_test_class'), 'Container has test service');
|
||||
|
||||
// Test that our synthetic services are there.
|
||||
$class_loader = $container->get('class_loader');
|
||||
$refClass = new \ReflectionClass($class_loader);
|
||||
$this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a class loader');
|
||||
|
||||
// Check that the location of the new module is registered.
|
||||
$modules = $container->getParameter('container.modules');
|
||||
$this->assertEqual($modules['service_provider_test'], array(
|
||||
'type' => 'module',
|
||||
'pathname' => drupal_get_filename('module', 'service_provider_test'),
|
||||
'filename' => NULL,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests repeated loading of compiled DIC with different environment.
|
||||
*/
|
||||
public function testRepeatedBootWithDifferentEnvironment() {
|
||||
$request = Request::createFromGlobals();
|
||||
$class_loader = require DRUPAL_ROOT . '/autoload.php';
|
||||
|
||||
$environments = [
|
||||
'testing1',
|
||||
'testing1',
|
||||
'testing2',
|
||||
'testing2',
|
||||
];
|
||||
|
||||
foreach ($environments as $environment) {
|
||||
$kernel = DrupalKernel::createFromRequest($request, $class_loader, $environment);
|
||||
$this->settingsSet('container_yamls', []);
|
||||
$this->settingsSet('hash_salt', $this->databasePrefix);
|
||||
$kernel->boot();
|
||||
}
|
||||
|
||||
$this->pass('Repeatedly loaded compiled DIC with different environment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests setting of site path after kernel boot.
|
||||
*/
|
||||
public function testPreventChangeOfSitePath() {
|
||||
// @todo: write a memory based storage backend for testing.
|
||||
$modules_enabled = array(
|
||||
'system' => 'system',
|
||||
'user' => 'user',
|
||||
);
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
$kernel = $this->getTestKernel($request, $modules_enabled);
|
||||
$pass = FALSE;
|
||||
try {
|
||||
$kernel->setSitePath('/dev/null');
|
||||
}
|
||||
catch (\LogicException $e) {
|
||||
$pass = TRUE;
|
||||
}
|
||||
$this->assertTrue($pass, 'Throws LogicException if DrupalKernel::setSitePath() is called after boot');
|
||||
}
|
||||
|
||||
}
|
|
@ -229,7 +229,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
|
|||
* The entity that the referencing entity should reference.
|
||||
*
|
||||
* @return \Drupal\Core\Entity\EntityInterface[]
|
||||
* An array containing a referencing entity and a non-referencing entity.
|
||||
* An array containing a referencing entity and a non-referencing entity.
|
||||
*/
|
||||
protected function createReferenceTestEntities($referenced_entity) {
|
||||
// All referencing entities should be of the type 'entity_test'.
|
||||
|
|
|
@ -36,7 +36,7 @@ class SiteMaintenanceTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Verify site maintenance mode functionality.
|
||||
* Verifies site maintenance mode functionality.
|
||||
*/
|
||||
protected function testSiteMaintenance() {
|
||||
$this->drupalGet(Url::fromRoute('user.page'));
|
||||
|
@ -131,4 +131,20 @@ class SiteMaintenanceTest extends WebTestBase {
|
|||
$this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests responses to non-HTML requests when in maintenance mode.
|
||||
*/
|
||||
public function testNonHtmlRequest() {
|
||||
$this->drupalLogout();
|
||||
\Drupal::state()->set('system.maintenance_mode', TRUE);
|
||||
$formats = ['json', 'xml', 'non-existing'];
|
||||
foreach ($formats as $format) {
|
||||
$this->pass('Testing format ' . $format);
|
||||
$this->drupalGet('<front>', ['query' => ['_format' => $format]]);
|
||||
$this->assertResponse(503);
|
||||
$this->assertRaw('Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.');
|
||||
$this->assertHeader('Content-Type', 'text/plain; charset=UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ class StableLibraryOverrideTest extends KernelTestBase {
|
|||
// Enable all core modules.
|
||||
$all_modules = system_rebuild_module_data();
|
||||
$all_modules = array_filter($all_modules, function ($module) {
|
||||
// Filter contrib, hidden, already enabled modules and modules in the
|
||||
// Testing package.
|
||||
if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
|
||||
// Filter contrib, hidden, experimental, already enabled modules, and
|
||||
// modules in the Testing package.
|
||||
if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing' || $module->info['package'] == 'Core (Experimental)') {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -671,7 +671,7 @@ function system_requirements($phase) {
|
|||
];
|
||||
}
|
||||
|
||||
$entity_update_issues = \Drupal::service('renderer')->render($build);
|
||||
$entity_update_issues = \Drupal::service('renderer')->renderPlain($build);
|
||||
$requirements['entity_update']['severity'] = REQUIREMENT_ERROR;
|
||||
$requirements['entity_update']['value'] = t('Mismatched entity and/or field definitions');
|
||||
$requirements['entity_update']['description'] = t('The following changes were detected in the entity type and field definitions. @updates', ['@updates' => $entity_update_issues]);
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
<js-placeholder token="{{ placeholder_token|raw }}">
|
||||
</head>
|
||||
<body{{ attributes }}>
|
||||
{#
|
||||
Keyboard navigation/accessibility link to main content section in
|
||||
page.html.twig.
|
||||
#}
|
||||
<a href="#main-content" class="visually-hidden focusable">
|
||||
{{ 'Skip to main content'|t }}
|
||||
</a>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\entity_test\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
/**
|
||||
* Defines an entity type with a multivalue base field.
|
||||
*
|
||||
* @ContentEntityType(
|
||||
* id = "entity_test_multivalue_basefield",
|
||||
* label = @Translation("Entity Test with a multivalue base field"),
|
||||
* base_table = "entity_test_multivalue_basefield",
|
||||
* data_table = "entity_test_multivalue_basefield_field_data",
|
||||
* handlers = {
|
||||
* "views_data" = "Drupal\views\EntityViewsData",
|
||||
* },
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "uuid" = "uuid",
|
||||
* "bundle" = "type",
|
||||
* "label" = "name",
|
||||
* "langcode" = "langcode",
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
class EntityTestMultiValueBasefield extends EntityTest {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
$fields['name']->setCardinality(2);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue