Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -182,13 +182,22 @@ small .admin-link:after {
|
|||
float: right;
|
||||
}
|
||||
.module-link-help {
|
||||
background: url(../../../misc/icons/787878/questionmark-disc.svg) 0 50% no-repeat;
|
||||
background: url(../../../misc/icons/787878/questionmark-disc.svg) 0 50% no-repeat; /* LTR */
|
||||
}
|
||||
[dir="rtl"] .module-link-help {
|
||||
background-position: top 50% right 0;
|
||||
}
|
||||
.module-link-permissions {
|
||||
background: url(../../../misc/icons/787878/key.svg) 0 50% no-repeat;
|
||||
background: url(../../../misc/icons/787878/key.svg) 0 50% no-repeat; /* LTR */
|
||||
}
|
||||
[dir="rtl"] .module-link-permissions {
|
||||
background-position: top 50% right 0;
|
||||
}
|
||||
.module-link-configure {
|
||||
background: url(../../../misc/icons/787878/cog.svg) 0 50% no-repeat;
|
||||
background: url(../../../misc/icons/787878/cog.svg) 0 50% no-repeat; /* LTR */
|
||||
}
|
||||
[dir="rtl"] .module-link-configure {
|
||||
background-position: top 50% right 0;
|
||||
}
|
||||
|
||||
/* Status report. */
|
||||
|
|
|
@ -35,13 +35,13 @@ class FileDownloadController extends ControllerBase {
|
|||
* @param string $scheme
|
||||
* The file scheme, defaults to 'private'.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* The transferred file as response.
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* Thrown when the requested file does not exist.
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
|
||||
* Thrown when the user does not have access to the file.
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
||||
* The transferred file as response.
|
||||
*/
|
||||
public function download(Request $request, $scheme = 'private') {
|
||||
$target = $request->query->get('file');
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\system\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Menu\MenuActiveTrailInterface;
|
||||
use Drupal\Core\Menu\MenuLinkTreeInterface;
|
||||
|
@ -194,9 +195,7 @@ class SystemMenuBlock extends BlockBase implements ContainerFactoryPluginInterfa
|
|||
// Additional cache contexts, e.g. those that determine link text or
|
||||
// accessibility of a menu, will be bubbled automatically.
|
||||
$menu_name = $this->getDerivativeId();
|
||||
return [
|
||||
'route.menu_active_trails:' . $menu_name,
|
||||
];
|
||||
return Cache::mergeContexts(parent::getCacheContexts(), ['route.menu_active_trails:' . $menu_name]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\systeml\Plugin\migrate\process\d6\TimeZone.
|
||||
* Contains \Drupal\system\Plugin\migrate\process\d6\TimeZone.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Plugin\migrate\process\d6;
|
||||
|
|
|
@ -464,7 +464,11 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
|||
$key_parts[] = $entity->getRevisionId();
|
||||
}
|
||||
|
||||
return implode('-', $key_parts);
|
||||
// An entity ID could be an arbitrary string (although they are typically
|
||||
// numeric). JSON then Base64 encoding ensures the the bulk_form_key is
|
||||
// safe to use in HTML, and that the key parts can be retrieved.
|
||||
$key = json_encode($key_parts);
|
||||
return base64_encode($key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -479,7 +483,8 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
|||
* as part of the bulk form key.
|
||||
*/
|
||||
protected function loadEntityFromBulkFormKey($bulk_form_key) {
|
||||
$key_parts = explode('-', $bulk_form_key);
|
||||
$key = base64_decode($bulk_form_key);
|
||||
$key_parts = json_decode($key);
|
||||
$revision_id = NULL;
|
||||
|
||||
// If there are 3 items, vid will be last.
|
||||
|
|
|
@ -36,11 +36,17 @@ class LibraryDiscoveryIntegrationTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensures that the element info can be altered by themes.
|
||||
* Tests that hook_library_info is invoked and the cache is cleared.
|
||||
*/
|
||||
public function testElementInfoByTheme() {
|
||||
public function testHookLibraryInfoByTheme() {
|
||||
// Activate test_theme and verify that the library 'kitten' is added using
|
||||
// hook_library_info_alter().
|
||||
$this->activateTheme('test_theme');
|
||||
$this->assertTrue($this->libraryDiscovery->getLibraryByName('test_theme', 'kitten'));
|
||||
|
||||
// Now make classy the active theme and assert that library is not added.
|
||||
$this->activateTheme('classy');
|
||||
$this->assertFalse($this->libraryDiscovery->getLibraryByName('test_theme', 'kitten'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Asset\ResolvedLibraryDefinitionsFilesMatchTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Asset;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests that the asset files for all core libraries exist.
|
||||
*
|
||||
* This test also changes the active theme to each core theme to verify
|
||||
* the libraries after theme-level libraries-override and libraries-extend are
|
||||
* applied.
|
||||
*
|
||||
* @group Asset
|
||||
*/
|
||||
class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* The theme handler.
|
||||
*
|
||||
* @var \Drupal\Core\Extension\ThemeHandlerInterface
|
||||
*/
|
||||
protected $themeHandler;
|
||||
|
||||
/**
|
||||
* The theme initialization.
|
||||
*
|
||||
* @var \Drupal\Core\Theme\ThemeInitializationInterface
|
||||
*/
|
||||
protected $themeInitialization;
|
||||
|
||||
/**
|
||||
* The theme manager.
|
||||
*
|
||||
* @var \Drupal\Core\Theme\ThemeManagerInterface
|
||||
*/
|
||||
protected $themeManager;
|
||||
|
||||
/**
|
||||
* The library discovery service.
|
||||
*
|
||||
* @var \Drupal\Core\Asset\LibraryDiscoveryInterface
|
||||
*/
|
||||
protected $libraryDiscovery;
|
||||
|
||||
/**
|
||||
* A list of all core modules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $allModules;
|
||||
|
||||
/**
|
||||
* A list of all core themes.
|
||||
*
|
||||
* We hardcode this because test themes don't use a 'package' or 'hidden' key
|
||||
* so we don't have a good way of filtering to only get "real" themes.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $allThemes = [
|
||||
'bartik',
|
||||
'classy',
|
||||
'seven',
|
||||
'stable',
|
||||
'stark',
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of libraries to skip checking, in the format extension/library_name.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $librariesToSkip = [
|
||||
// Locale has a "dummy" library that does not actually exist.
|
||||
'locale/translations',
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of all paths that have been checked.
|
||||
*
|
||||
* @var array[]
|
||||
*/
|
||||
protected $pathsChecked;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->themeHandler = $this->container->get('theme_handler');
|
||||
$this->themeInitialization = $this->container->get('theme.initialization');
|
||||
$this->themeManager = $this->container->get('theme.manager');
|
||||
$this->libraryDiscovery = $this->container->get('library.discovery');
|
||||
|
||||
// Install all core themes.
|
||||
sort($this->allThemes);
|
||||
$this->container->get('theme_installer')->install($this->allThemes);
|
||||
|
||||
// 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') {
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
});
|
||||
$this->allModules = array_keys($all_modules);
|
||||
sort($this->allModules);
|
||||
$this->enableModules($this->allModules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that all core module and theme library files exist.
|
||||
*/
|
||||
public function testCoreLibraryCompleteness() {
|
||||
// First verify all libraries with no active theme.
|
||||
$this->verifyLibraryFilesExist($this->getAllLibraries());
|
||||
|
||||
// Then verify all libraries for each core theme. This may seem like
|
||||
// overkill but themes can override and extend other extensions' libraries
|
||||
// and these changes are only applied for the active theme.
|
||||
foreach ($this->allThemes as $theme) {
|
||||
$this->themeManager->setActiveTheme($this->themeInitialization->getActiveThemeByName($theme));
|
||||
$this->libraryDiscovery->clearCachedDefinitions();
|
||||
|
||||
$this->verifyLibraryFilesExist($this->getAllLibraries());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that all the library files exist.
|
||||
*
|
||||
* @param array[]
|
||||
* An array of library definitions, keyed by extension, then by library, and
|
||||
* so on.
|
||||
*/
|
||||
protected function verifyLibraryFilesExist($library_definitions) {
|
||||
$root = \Drupal::root();
|
||||
foreach ($library_definitions as $extension => $libraries) {
|
||||
foreach ($libraries as $library_name => $library) {
|
||||
if (in_array("$extension/$library_name", $this->librariesToSkip)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check that all the assets exist.
|
||||
foreach (['css', 'js'] as $asset_type) {
|
||||
foreach ($library[$asset_type] as $asset) {
|
||||
$file = $asset['data'];
|
||||
$path = $root . '/' . $file;
|
||||
// Only check and assert each file path once.
|
||||
if (!isset($this->pathsChecked[$path])) {
|
||||
$this->assertTrue(is_file($path), "$file file referenced from the $extension/$library_name library exists.");
|
||||
$this->pathsChecked[$path] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all libraries for core and all installed modules.
|
||||
*
|
||||
* @return \Drupal\Core\Extension\Extension[]
|
||||
*/
|
||||
protected function getAllLibraries() {
|
||||
$modules = \Drupal::moduleHandler()->getModuleList();
|
||||
$extensions = $modules;
|
||||
$module_list = array_keys($modules);
|
||||
sort($module_list);
|
||||
$this->assertEqual($this->allModules, $module_list, 'All core modules are installed.');
|
||||
|
||||
$themes = $this->themeHandler->listInfo();
|
||||
$extensions += $themes;
|
||||
$theme_list = array_keys($themes);
|
||||
sort($theme_list);
|
||||
$this->assertEqual($this->allThemes, $theme_list, 'All core themes are installed.');
|
||||
|
||||
$libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core');
|
||||
|
||||
$root = \Drupal::root();
|
||||
foreach ($extensions as $extension_name => $extension) {
|
||||
$library_file = $extension->getPath() . '/' . $extension_name . '.libraries.yml';
|
||||
if (is_file($root . '/' . $library_file)) {
|
||||
$libraries[$extension_name] = $this->libraryDiscovery->getLibrariesByExtension($extension_name);
|
||||
}
|
||||
}
|
||||
return $libraries;
|
||||
}
|
||||
|
||||
}
|
|
@ -108,8 +108,10 @@ class AttachedAssetsTest extends KernelTestBase {
|
|||
$build['#attached']['library'][] = 'core/drupalSettings';
|
||||
$assets = AttachedAssets::createFromRenderArray($build);
|
||||
|
||||
$this->assertEqual([], $assets->getSettings(), 'JavaScript settings on $assets are empty.');
|
||||
$javascript = $this->assetResolver->getJsAssets($assets, FALSE)[1];
|
||||
$this->assertTrue(array_key_exists('currentPath', $javascript['drupalSettings']['data']['path']), 'The current path JavaScript setting is set correctly.');
|
||||
$this->assertTrue(array_key_exists('currentPath', $assets->getSettings()['path']), 'JavaScript settings on $assets are resolved after retrieving JavaScript assets, and are equal to the returned JavaScript settings.');
|
||||
|
||||
$assets->setSettings(['drupal' => 'rocks', 'dries' => 280342800]);
|
||||
$javascript = $this->assetResolver->getJsAssets($assets, FALSE)[1];
|
||||
|
@ -182,12 +184,9 @@ class AttachedAssetsTest extends KernelTestBase {
|
|||
list($header_js, $footer_js) = $this->assetResolver->getJsAssets($assets, TRUE);
|
||||
$this->assertEqual([], \Drupal::service('asset.js.collection_renderer')->render($header_js), 'There are 0 JavaScript assets in the header.');
|
||||
$rendered_footer_js = \Drupal::service('asset.js.collection_renderer')->render($footer_js);
|
||||
$this->assertTrue(
|
||||
count($rendered_footer_js) == 2
|
||||
&& $rendered_footer_js[0]['#attributes']['data-drupal-selector'] === 'drupal-settings-json'
|
||||
&& substr($rendered_footer_js[1]['#attributes']['src'], 0, 7) === 'http://',
|
||||
'There are 2 JavaScript assets in the footer: one with drupal settings, one with the sole aggregated JavaScript asset.'
|
||||
);
|
||||
$this->assertEqual(2, count($rendered_footer_js), 'There are 2 JavaScript assets in the footer.');
|
||||
$this->assertEqual('drupal-settings-json', $rendered_footer_js[0]['#attributes']['data-drupal-selector'], 'The first of the two JavaScript assets in the footer has drupal settings.');
|
||||
$this->assertEqual('http://', substr($rendered_footer_js[1]['#attributes']['src'], 0, 7), 'The second of the two JavaScript assets in the footer has the sole aggregated JavaScript asset.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Definition of Drupal\system\Tests\Database\LargeQueryTest.
|
||||
* Contains \Drupal\system\Tests\Database\LargeQueryTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Database;
|
||||
|
|
|
@ -104,6 +104,20 @@ trait EntityDefinitionTestTrait {
|
|||
$this->state->set('entity_test_update.additional_base_field_definitions', $definitions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a long-named base field to the 'entity_test_update' entity type.
|
||||
*/
|
||||
protected function addLongNameBaseField() {
|
||||
$key = 'entity_test_update.additional_base_field_definitions';
|
||||
$definitions = $this->state->get($key, []);
|
||||
$definitions['new_long_named_entity_reference_base_field'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setName('new_long_named_entity_reference_base_field')
|
||||
->setLabel(t('A new long-named base field'))
|
||||
->setSetting('target_type', 'user')
|
||||
->setSetting('handler', 'default');
|
||||
$this->state->set($key, $definitions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new revisionable base field to the 'entity_test_update' entity type.
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@ use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
|
|||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionEvents;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\entity_test\Entity\EntityTestUpdate;
|
||||
|
||||
/**
|
||||
* Tests EntityDefinitionUpdateManager functionality.
|
||||
|
@ -796,4 +797,17 @@ class EntityDefinitionUpdateTest extends EntityUnitTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that field schema is correctly handled with long-named fields.
|
||||
*/
|
||||
function testLongNameFieldIndexes() {
|
||||
$this->addLongNameBaseField();
|
||||
$entity_type_id = 'entity_test_update';
|
||||
$entity_type = $this->entityManager->getDefinition($entity_type_id);
|
||||
$definitions = EntityTestUpdate::baseFieldDefinitions($entity_type);
|
||||
$name = 'new_long_named_entity_reference_base_field';
|
||||
$this->entityDefinitionUpdateManager->installFieldStorageDefinition($name, $entity_type_id, 'entity_test', $definitions[$name]);
|
||||
$this->assertFalse($this->entityDefinitionUpdateManager->needsUpdates(), 'Entity and field schema data are correctly detected.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -144,14 +144,14 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
|
|||
// Check that the status report initially displays no error.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertNoRaw('Out of date');
|
||||
$this->assertNoRaw('Mismatch detected');
|
||||
$this->assertNoRaw('Mismatched entity and/or field definitions');
|
||||
|
||||
// Enable an entity update and check that we have a dedicated status report
|
||||
// item.
|
||||
$this->container->get('state')->set('entity_test.remove_name_field', TRUE);
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertNoRaw('Out of date');
|
||||
$this->assertRaw('Mismatch detected');
|
||||
$this->assertRaw('Mismatched entity and/or field definitions');
|
||||
|
||||
// Enable a db update and check that now the entity update status report
|
||||
// item is no longer displayed. We assume an update function will fix the
|
||||
|
@ -159,13 +159,13 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
|
|||
$this->enableUpdates('entity_test', 'status_report', 8001);
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertRaw('Out of date');
|
||||
$this->assertNoRaw('Mismatch detected');
|
||||
$this->assertRaw('Mismatched entity and/or field definitions');
|
||||
|
||||
// Apply db updates and check that entity updates were not applied.
|
||||
$this->applyUpdates();
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertNoRaw('Out of date');
|
||||
$this->assertRaw('Mismatch detected');
|
||||
$this->assertRaw('Mismatched entity and/or field definitions');
|
||||
|
||||
// Check that en exception would be triggered when trying to apply them with
|
||||
// existing data.
|
||||
|
@ -181,7 +181,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
|
|||
// Check the status report is the same after trying to apply updates.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertNoRaw('Out of date');
|
||||
$this->assertRaw('Mismatch detected');
|
||||
$this->assertRaw('Mismatched entity and/or field definitions');
|
||||
|
||||
// Delete entity data, enable a new update, run updates again and check that
|
||||
// entity updates were not applied even when no data exists.
|
||||
|
@ -190,7 +190,7 @@ class UpdateApiEntityDefinitionUpdateTest extends WebTestBase {
|
|||
$this->applyUpdates();
|
||||
$this->drupalGet('admin/reports/status');
|
||||
$this->assertNoRaw('Out of date');
|
||||
$this->assertRaw('Mismatch detected');
|
||||
$this->assertRaw('Mismatched entity and/or field definitions');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\system\Tests\Field\FieldItemTest.
|
||||
* Contains \Drupal\system\Tests\Field\FieldItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Field;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\system\Tests\Field\FieldSettingsTest.
|
||||
* Contains \Drupal\system\Tests\Field\FieldSettingsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Field;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\system\Tests\Form\ElementsAccessTest.
|
||||
* Contains \Drupal\system\Tests\Form\ElementsAccessTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Form;
|
||||
|
|
|
@ -45,7 +45,7 @@ class DistributionProfileTest extends InstallerTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides InstallerTest::setUpLanguage().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpLanguage() {
|
||||
// Verify that the distribution name appears.
|
||||
|
@ -59,7 +59,7 @@ class DistributionProfileTest extends InstallerTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides InstallerTest::setUpProfile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpProfile() {
|
||||
// This step is skipped, because there is a distribution profile.
|
||||
|
|
|
@ -26,7 +26,7 @@ class InstallerTranslationTest extends InstallerTestBase {
|
|||
protected $langcode = 'de';
|
||||
|
||||
/**
|
||||
* Overrides InstallerTest::setUpLanguage().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpLanguage() {
|
||||
// Place a custom local translation in the translations directory.
|
||||
|
|
|
@ -49,7 +49,7 @@ class SingleVisibleProfileTest extends InstallerTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides InstallerTest::setUpProfile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpProfile() {
|
||||
// This step is skipped, because there is only one visible profile.
|
||||
|
|
|
@ -24,7 +24,7 @@ class SiteNameTest extends WebTestBase {
|
|||
protected $siteName;
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\simpletest\WebTestBase::installParameters().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function installParameters() {
|
||||
$this->siteName = $this->randomMachineName();
|
||||
|
|
|
@ -31,7 +31,7 @@ class MockMatcher implements RequestMatcherInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Symfony\Component\Routing\Matcher\RequestMatcherInterface::matchRequest().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function matchRequest(Request $request) {
|
||||
$matcher = $this->matcher;
|
||||
|
|
|
@ -45,7 +45,7 @@ class MockRouteProvider implements RouteProviderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Symfony\Cmf\Component\Routing\RouteProviderInterface::getRouteByName().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRouteByName($name) {
|
||||
$routes = $this->getRoutesByNames(array($name));
|
||||
|
@ -64,7 +64,7 @@ class MockRouteProvider implements RouteProviderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Symfony\Cmf\Component\Routing\RouteProviderInterface::getRoutesByName().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRoutesByNames($names) {
|
||||
$routes = array();
|
||||
|
|
|
@ -44,6 +44,11 @@ class DefaultMobileMetaTagsTest extends WebTestBase {
|
|||
* Verifies that the default mobile meta tags can be removed.
|
||||
*/
|
||||
public function testRemovingDefaultMetaTags() {
|
||||
// @todo remove once PHP7 on Drupal CI has the fix.
|
||||
if (version_compare(phpversion(), '7.0.0-dev') >= 0) {
|
||||
// @see https://bugs.php.net/bug.php?id=70808
|
||||
return;
|
||||
}
|
||||
\Drupal::service('module_installer')->install(array('system_module_test'));
|
||||
$this->drupalGet('');
|
||||
foreach ($this->defaultMetaTags as $name => $metatag) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\System\UncaughtExceptionTest
|
||||
* Contains \Drupal\system\Tests\System\UncaughtExceptionTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\System;
|
||||
|
@ -137,6 +137,7 @@ class UncaughtExceptionTest extends WebTestBase {
|
|||
$settings_php .= " print('Oh oh, flying teapots');\n";
|
||||
$settings_php .= " exit();\n";
|
||||
$settings_php .= "});\n";
|
||||
$settings_php .= "\$settings['teapots'] = TRUE;\n";
|
||||
file_put_contents($settings_filename, $settings_php);
|
||||
|
||||
$this->drupalGet('broken-service-class');
|
||||
|
@ -254,7 +255,7 @@ class UncaughtExceptionTest extends WebTestBase {
|
|||
$this->assertIdentical(count($errors), 1, 'Exactly one line logged to the PHP error log');
|
||||
|
||||
$expected_path = \Drupal::root() . '/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php';
|
||||
$expected_line = 61;
|
||||
$expected_line = 63;
|
||||
$expected_entry = "Failed to log error: Exception: Deforestation in Drupal\\error_service_test\\MonkeysInTheControlRoom->handle() (line ${expected_line} of ${expected_path})";
|
||||
$this->assert(strpos($errors[0], $expected_entry) !== FALSE, 'Original error logged to the PHP error log when an exception is thrown by a logger');
|
||||
|
||||
|
|
130
core/modules/system/src/Tests/Theme/TwigWhiteListTest.php
Normal file
130
core/modules/system/src/Tests/Theme/TwigWhiteListTest.php
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Theme\TwigWhiteListTest.php.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Theme;
|
||||
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\taxonomy\Entity\Term;
|
||||
use Drupal\taxonomy\Entity\Vocabulary;
|
||||
|
||||
/**
|
||||
* Tests white-listing of entity properties.
|
||||
*
|
||||
* @group Theme
|
||||
*/
|
||||
class TwigWhiteListTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Term for referencing.
|
||||
*
|
||||
* @var \Drupal\taxonomy\TermInterface
|
||||
*/
|
||||
protected $term;
|
||||
|
||||
/**
|
||||
* Twig environment.
|
||||
*
|
||||
* @var \Drupal\Core\Template\TwigEnvironment
|
||||
*/
|
||||
protected $twig;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['node', 'taxonomy', 'user', 'system', 'text', 'field', 'entity_reference'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('system', array('router', 'sequences'));
|
||||
$this->installEntitySchema('node');
|
||||
$this->installEntitySchema('user');
|
||||
$this->installEntitySchema('taxonomy_term');
|
||||
NodeType::create([
|
||||
'type' => 'page',
|
||||
'name' => 'Basic page',
|
||||
'display_submitted' => FALSE,
|
||||
])->save();
|
||||
// Add a vocabulary so we can test different view modes.
|
||||
$vocabulary = Vocabulary::create([
|
||||
'name' => $this->randomMachineName(),
|
||||
'description' => $this->randomMachineName(),
|
||||
'vid' => $this->randomMachineName(),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
'help' => '',
|
||||
]);
|
||||
$vocabulary->save();
|
||||
|
||||
// Add a term to the vocabulary.
|
||||
$this->term = Term::create([
|
||||
'name' => 'Sometimes people are just jerks',
|
||||
'description' => $this->randomMachineName(),
|
||||
'vid' => $vocabulary->id(),
|
||||
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
|
||||
]);
|
||||
$this->term->save();
|
||||
|
||||
// Create a field.
|
||||
$handler_settings = array(
|
||||
'target_bundles' => array(
|
||||
$vocabulary->id() => $vocabulary->id(),
|
||||
),
|
||||
'auto_create' => TRUE,
|
||||
);
|
||||
// Add the term field.
|
||||
FieldStorageConfig::create(array(
|
||||
'field_name' => 'field_term',
|
||||
'type' => 'entity_reference',
|
||||
'entity_type' => 'node',
|
||||
'cardinality' => 1,
|
||||
'settings' => array(
|
||||
'target_type' => 'taxonomy_term',
|
||||
),
|
||||
))->save();
|
||||
FieldConfig::create(array(
|
||||
'field_name' => 'field_term',
|
||||
'entity_type' => 'node',
|
||||
'bundle' => 'page',
|
||||
'label' => 'Terms',
|
||||
'settings' => array(
|
||||
'handler' => 'default',
|
||||
'handler_settings' => $handler_settings,
|
||||
),
|
||||
))->save();
|
||||
|
||||
// Show on default display and teaser.
|
||||
entity_get_display('node', 'page', 'default')
|
||||
->setComponent('field_term', array(
|
||||
'type' => 'entity_reference_label',
|
||||
))
|
||||
->save();
|
||||
// Boot twig environment.
|
||||
$this->twig = \Drupal::service('twig');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests white-listing of methods doesn't interfere with chaining.
|
||||
*/
|
||||
public function testWhiteListChaining() {
|
||||
$node = Node::create([
|
||||
'type' => 'page',
|
||||
'title' => 'Some node mmk',
|
||||
'status' => 1,
|
||||
'field_term' => $this->term->id(),
|
||||
]);
|
||||
$node->save();
|
||||
$this->setRawContent(twig_render_template(drupal_get_path('theme', 'test_theme') . '/templates/node.html.twig', ['node' => $node]));
|
||||
$this->assertText('Sometimes people are just jerks');
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Update\LocalActionsAndTasksConvertedIntoBlocksUpdateTest.
|
||||
* Contains \Drupal\system\Tests\Update\SiteBrandingConvertedIntoBlockUpdateTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Update;
|
||||
|
|
|
@ -0,0 +1,434 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathRC1TestBaseFilledTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Update;
|
||||
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\user\Entity\User;
|
||||
|
||||
/**
|
||||
* Runs UpdatePathTestBaseTest with a RC1 dump filled with content.
|
||||
*
|
||||
* @group Update
|
||||
*/
|
||||
class UpdatePathRC1TestBaseFilledTest extends UpdatePathRC1TestBaseTest {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDatabaseDumpFiles() {
|
||||
parent::setDatabaseDumpFiles();
|
||||
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8-rc1.filled.standard.php.gz';
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the content and configuration were properly updated.
|
||||
*/
|
||||
public function testUpdatedSite() {
|
||||
// @todo there are no updates to run.
|
||||
//$this->runUpdates();
|
||||
|
||||
$spanish = \Drupal::languageManager()->getLanguage('es');
|
||||
|
||||
$expected_node_data = array(
|
||||
[1, 'article', 'en', 'Test Article - New title'],
|
||||
[2, 'book', 'en', 'Book page'],
|
||||
[3, 'forum', 'en', 'Forum topic'],
|
||||
[4, 'page', 'en', 'Test page'],
|
||||
[8, 'test_content_type', 'en', 'Test title'],
|
||||
);
|
||||
foreach ($expected_node_data as $node_data) {
|
||||
$id = $node_data[0];
|
||||
$type = $node_data[1];
|
||||
$langcode = $node_data[2];
|
||||
$title = $node_data[3];
|
||||
|
||||
// Make sure our English nodes still exist.
|
||||
$node = Node::load($id);
|
||||
$this->assertEqual($node->language()->getId(), $langcode);
|
||||
$this->assertEqual($node->getType(), $type);
|
||||
$this->assertEqual($node->getTitle(), $title);
|
||||
// Assert that nodes are all published.
|
||||
$this->assertTrue($node->isPublished());
|
||||
$this->drupalGet('node/' . $id);
|
||||
$this->assertText($title);
|
||||
}
|
||||
|
||||
// Make sure the translated node still exists.
|
||||
$translation = Node::load(8)->getTranslation('es');
|
||||
$this->assertEqual('Test title Spanish', $translation->getTitle());
|
||||
|
||||
// Make sure our alias still works.
|
||||
$this->drupalGet('test-article');
|
||||
$this->assertText('Test Article - New title');
|
||||
$this->assertText('Body');
|
||||
$this->assertText('Tags');
|
||||
|
||||
// Make sure a translated page exists.
|
||||
$this->drupalGet('node/8', ['language' => $spanish]);
|
||||
// Check for text of two comments.
|
||||
$this->assertText('Hola');
|
||||
$this->assertText('Hello');
|
||||
// The user entity reference field is access restricted.
|
||||
$this->assertNoText('Test 12');
|
||||
// Make sure all other field labels are there.
|
||||
for ($i = 1; $i <= 23; $i++) {
|
||||
if ($i != 12) {
|
||||
$this->assertText('Test ' . $i);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the translated slogan appears.
|
||||
$this->assertText('drupal Spanish');
|
||||
|
||||
// Make sure the custom block appears.
|
||||
$this->drupalGet('<front>');
|
||||
// Block title.
|
||||
$this->assertText('Another block');
|
||||
// Block body.
|
||||
$this->assertText('Hello');
|
||||
|
||||
// Log in as user 1.
|
||||
$account = User::load(1);
|
||||
$account->pass_raw = 'drupal';
|
||||
$this->drupalLogin($account);
|
||||
|
||||
// Make sure we can see the access-restricted entity reference field
|
||||
// now that we're logged in.
|
||||
$this->drupalGet('node/8', ['language' => $spanish]);
|
||||
$this->assertText('Test 12');
|
||||
$this->assertLink('drupal');
|
||||
|
||||
// Make sure the content for node 8 is still in the edit form.
|
||||
$this->drupalGet('node/8/edit');
|
||||
$this->assertText('Test title');
|
||||
$this->assertText('Test body');
|
||||
$this->assertFieldChecked('edit-field-test-1-value');
|
||||
$this->assertRaw('2015-08-16');
|
||||
$this->assertRaw('test@example.com');
|
||||
$this->assertRaw('drupal.org');
|
||||
$this->assertText('0.1');
|
||||
$this->assertText('0.2');
|
||||
$this->assertRaw('+31612345678');
|
||||
$this->assertRaw('+31612345679');
|
||||
$this->assertText('Test Article - New title');
|
||||
$this->assertText('test.txt');
|
||||
$this->assertText('druplicon.small');
|
||||
$this->assertRaw('General discussion');
|
||||
$this->assertText('Test Article - New title');
|
||||
$this->assertText('Test 1');
|
||||
$this->assertRaw('0.01');
|
||||
$this->drupalPostForm('node/8/edit', [], 'Save and keep published (this translation)');
|
||||
$this->assertResponse(200);
|
||||
$this->drupalGet('node/8/edit', ['language' => $spanish]);
|
||||
$this->assertText('Test title Spanish');
|
||||
$this->assertText('Test body Spanish');
|
||||
|
||||
// Make sure the user page is correct.
|
||||
$this->drupalGet('user/3');
|
||||
$this->assertText('usuario_test');
|
||||
$this->assertRaw('druplicon.small');
|
||||
$this->assertText('Test file field');
|
||||
$this->assertLink('test.txt');
|
||||
|
||||
// Make sure the user is translated.
|
||||
$this->drupalGet('user/3/translations');
|
||||
$this->assertNoText('Not translated');
|
||||
|
||||
// Make sure the custom field on the user is still there.
|
||||
$this->drupalGet('admin/config/people/accounts/fields');
|
||||
$this->assertText('Test file field');
|
||||
|
||||
// Make sure the test view still exists.
|
||||
$this->drupalGet('admin/structure/views/view/test_view');
|
||||
$this->assertText('Test view');
|
||||
|
||||
// Make sure the book node exists.
|
||||
$this->drupalGet('admin/structure/book');
|
||||
$this->clickLink('Test Article - New title');
|
||||
$this->assertText('Body');
|
||||
$this->assertText('Tags');
|
||||
$this->assertRaw('Text format');
|
||||
|
||||
// Make sure that users still exist.
|
||||
$this->drupalGet('admin/people');
|
||||
$this->assertText('usuario_test');
|
||||
$this->assertText('drupal');
|
||||
$this->drupalGet('user/1/edit');
|
||||
$this->assertRaw('drupal@example.com');
|
||||
|
||||
// Make sure the content view works.
|
||||
$this->drupalGet('admin/content');
|
||||
$this->assertText('Test title');
|
||||
|
||||
// Make sure our custom blocks show up.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$this->assertText('Another block');
|
||||
$this->assertText('Test block');
|
||||
$this->drupalGet('admin/structure/block/block-content');
|
||||
$this->assertText('Another block');
|
||||
$this->assertText('Test block');
|
||||
|
||||
// Make sure our custom visibility conditions are correct.
|
||||
$this->drupalGet('admin/structure/block/manage/testblock');
|
||||
$this->assertNoFieldChecked('edit-visibility-language-langcodes-es');
|
||||
$this->assertFieldChecked('edit-visibility-language-langcodes-en');
|
||||
$this->assertNoFieldChecked('edit-visibility-node-type-bundles-book');
|
||||
$this->assertFieldChecked('edit-visibility-node-type-bundles-test-content-type');
|
||||
|
||||
// Make sure our block is still translated.
|
||||
$this->drupalGet('admin/structure/block/manage/testblock/translate/es/edit');
|
||||
$this->assertRaw('Test block spanish');
|
||||
|
||||
// Make sure our custom text format exists.
|
||||
$this->drupalGet('admin/config/content/formats');
|
||||
$this->assertText('Test text format');
|
||||
$this->drupalGet('admin/config/content/formats/manage/test_text_format');
|
||||
$this->assertResponse('200');
|
||||
|
||||
// Make sure our feed still exists.
|
||||
$this->drupalGet('admin/config/services/aggregator');
|
||||
$this->assertText('Test feed');
|
||||
$this->drupalGet('admin/config/services/aggregator/fields');
|
||||
$this->assertText('field_test');
|
||||
|
||||
// Make sure our view appears in the overview.
|
||||
$this->drupalGet('admin/structure/views');
|
||||
$this->assertText('test_view');
|
||||
$this->assertText('Test view');
|
||||
|
||||
// Make sure our custom forum exists.
|
||||
$this->drupalGet('admin/structure/forum');
|
||||
$this->assertText('Test forum');
|
||||
|
||||
// Make sure our custom menu exists.
|
||||
$this->drupalGet('admin/structure/menu');
|
||||
$this->assertText('Test menu');
|
||||
|
||||
// Make sure our custom menu exists.
|
||||
$this->drupalGet('admin/structure/menu/manage/test-menu');
|
||||
$this->clickLink('Admin');
|
||||
// Make sure the translation for the menu is still correct.
|
||||
$this->drupalGet('admin/structure/menu/manage/test-menu/translate/es/edit');
|
||||
$this->assertRaw('Menu test');
|
||||
// Make sure our custom menu link exists.
|
||||
$this->drupalGet('admin/structure/menu/item/1/edit');
|
||||
$this->assertFieldChecked('edit-enabled-value');
|
||||
|
||||
// Make sure our comment type exists.
|
||||
$this->drupalGet('admin/structure/comment');
|
||||
$this->assertText('Test comment type');
|
||||
$this->drupalGet('admin/structure/comment/manage/test_comment_type/fields');
|
||||
$this->assertText('comment_body');
|
||||
|
||||
// Make sure our contact form exists.
|
||||
$this->drupalGet('admin/structure/contact');
|
||||
$this->assertText('Test contact form');
|
||||
$this->drupalGet('admin/structure/types');
|
||||
$this->assertText('Test content type description');
|
||||
$this->drupalGet('admin/structure/types/manage/test_content_type/fields');
|
||||
|
||||
// Make sure fields are the right type.
|
||||
$this->assertLink('Text (formatted, long, with summary)');
|
||||
$this->assertLink('Boolean');
|
||||
$this->assertLink('Comments');
|
||||
$this->assertLink('Date');
|
||||
$this->assertLink('Email');
|
||||
$this->assertLink('Link');
|
||||
$this->assertLink('List (float)');
|
||||
$this->assertLink('Telephone number');
|
||||
$this->assertLink('Entity reference');
|
||||
$this->assertLink('File');
|
||||
$this->assertLink('Image');
|
||||
$this->assertLink('Text (plain, long)');
|
||||
$this->assertLink('List (text)');
|
||||
$this->assertLink('Text (formatted, long)');
|
||||
$this->assertLink('Text (plain)');
|
||||
$this->assertLink('List (integer)');
|
||||
$this->assertLink('Number (integer)');
|
||||
$this->assertLink('Number (float)');
|
||||
|
||||
// Make sure our form mode exists.
|
||||
$this->drupalGet('admin/structure/display-modes/form');
|
||||
$this->assertText('New form mode');
|
||||
|
||||
// Make sure our view mode exists.
|
||||
$this->drupalGet('admin/structure/display-modes/view');
|
||||
$this->assertText('New view mode');
|
||||
$this->drupalGet('admin/structure/display-modes/view/manage/node.new_view_mode');
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Make sure our other language is still there.
|
||||
$this->drupalGet('admin/config/regional/language');
|
||||
$this->assertText('Spanish');
|
||||
|
||||
// Make sure our custom date format exists.
|
||||
$this->drupalGet('admin/config/regional/date-time');
|
||||
$this->assertText('Test date format');
|
||||
$this->drupalGet('admin/config/regional/date-time/formats/manage/test_date_format');
|
||||
$this->assertOptionSelected('edit-langcode', 'es');
|
||||
|
||||
// Make sure our custom image style exists.
|
||||
$this->drupalGet('admin/config/media/image-styles/manage/test_image_style');
|
||||
$this->assertText('Test image style');
|
||||
$this->assertText('Desaturate');
|
||||
$this->assertText('Convert PNG');
|
||||
|
||||
// Make sure our custom responsive image style exists.
|
||||
$this->drupalGet('admin/config/media/responsive-image-style/test');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText('Test');
|
||||
|
||||
// Make sure our custom shortcut exists.
|
||||
$this->drupalGet('admin/config/user-interface/shortcut');
|
||||
$this->assertText('Test shortcut');
|
||||
$this->drupalGet('admin/config/user-interface/shortcut/manage/test/customize');
|
||||
$this->assertText('All content');
|
||||
|
||||
// Make sure our language detection settings are still correct.
|
||||
$this->drupalGet('admin/config/regional/language/detection');
|
||||
$this->assertFieldChecked('edit-language-interface-enabled-language-user-admin');
|
||||
$this->assertFieldChecked('edit-language-interface-enabled-language-url');
|
||||
$this->assertFieldChecked('edit-language-interface-enabled-language-session');
|
||||
$this->assertFieldChecked('edit-language-interface-enabled-language-user');
|
||||
$this->assertFieldChecked('edit-language-interface-enabled-language-browser');
|
||||
|
||||
// Make sure strings are still translated.
|
||||
$this->drupalGet('admin/structure/views/view/content/translate/es/edit');
|
||||
$this->assertText('Contenido');
|
||||
$this->drupalPostForm('admin/config/regional/translate', ['string' => 'Full comment'], 'Filter');
|
||||
$this->assertText('Comentario completo');
|
||||
|
||||
// Make sure our custom action is still there.
|
||||
$this->drupalGet('admin/config/system/actions');
|
||||
$this->assertText('Test action');
|
||||
$this->drupalGet('admin/config/system/actions/configure/test_action');
|
||||
$this->assertText('test_action');
|
||||
$this->assertRaw('drupal.org');
|
||||
|
||||
// Make sure our ban still exists.
|
||||
$this->drupalGet('admin/config/people/ban');
|
||||
$this->assertText('8.8.8.8');
|
||||
|
||||
// Make sure our vocabulary exists.
|
||||
$this->drupalGet('admin/structure/taxonomy/manage/test_vocabulary/overview');
|
||||
|
||||
// Make sure our terms exist.
|
||||
$this->assertText('Test root term');
|
||||
$this->assertText('Test child term');
|
||||
$this->drupalGet('taxonomy/term/3');
|
||||
$this->assertResponse('200');
|
||||
|
||||
// Make sure the terms are still translated.
|
||||
$this->drupalGet('taxonomy/term/2/translations');
|
||||
$this->assertLink('Test root term - Spanish');
|
||||
|
||||
// Make sure our contact form exists.
|
||||
$this->drupalGet('admin/structure/contact');
|
||||
$this->assertText('Test contact form');
|
||||
$this->drupalGet('admin/structure/contact/manage/test_contact_form');
|
||||
$this->assertText('test@example.com');
|
||||
$this->assertText('Hello');
|
||||
$this->drupalGet('admin/structure/contact/manage/test_contact_form/translate/es/edit');
|
||||
$this->assertText('Hola');
|
||||
$this->assertRaw('Test contact form Spanish');
|
||||
|
||||
// Make sure our modules are still enabled.
|
||||
$expected_enabled_modules = [
|
||||
'action',
|
||||
'aggregator',
|
||||
'ban',
|
||||
'basic_auth',
|
||||
'block',
|
||||
'block_content',
|
||||
'book',
|
||||
'breakpoint',
|
||||
'ckeditor',
|
||||
'color',
|
||||
'comment',
|
||||
'config',
|
||||
'config_translation',
|
||||
'contact',
|
||||
'content_translation',
|
||||
'contextual',
|
||||
'datetime',
|
||||
'dblog',
|
||||
'editor',
|
||||
'field',
|
||||
'field_ui',
|
||||
'file',
|
||||
'filter',
|
||||
'hal',
|
||||
'help',
|
||||
'history',
|
||||
'image',
|
||||
'language',
|
||||
'link',
|
||||
'locale',
|
||||
'menu_ui',
|
||||
'migrate',
|
||||
'migrate_drupal',
|
||||
'node',
|
||||
'options',
|
||||
'page_cache',
|
||||
'path',
|
||||
'quickedit',
|
||||
'rdf',
|
||||
'responsive_image',
|
||||
'rest',
|
||||
'search',
|
||||
'serialization',
|
||||
'shortcut',
|
||||
'simpletest',
|
||||
'statistics',
|
||||
'syslog',
|
||||
'system',
|
||||
'taxonomy',
|
||||
'telephone',
|
||||
'text',
|
||||
'toolbar',
|
||||
'tour',
|
||||
'tracker',
|
||||
'update',
|
||||
'user',
|
||||
'views_ui',
|
||||
'forum',
|
||||
'menu_link_content',
|
||||
'views',
|
||||
'standard',
|
||||
];
|
||||
foreach ($expected_enabled_modules as $module) {
|
||||
$this->assertTrue($this->container->get('module_handler')->moduleExists($module), 'The "' . $module . '" module is still enabled.');
|
||||
}
|
||||
|
||||
// Make sure our themes are still enabled.
|
||||
$expected_enabled_themes = [
|
||||
'bartik',
|
||||
'classy',
|
||||
'seven',
|
||||
'stark',
|
||||
];
|
||||
foreach ($expected_enabled_themes as $theme) {
|
||||
$this->assertTrue($this->container->get('theme_handler')->themeExists($theme), 'The "' . $theme . '" is still enabled.');
|
||||
}
|
||||
|
||||
// Ensure that the Book module's node type does not have duplicated enforced
|
||||
// dependencies.
|
||||
// @see system_post_update_fix_enforced_dependencies()
|
||||
$book_node_type = NodeType::load('book');
|
||||
$this->assertEqual(['enforced' => ['module' => ['book']]], $book_node_type->get('dependencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function replaceUser1() {
|
||||
// Do not replace the user from our dump.
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathRC1TestBaseTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Update;
|
||||
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
|
||||
/**
|
||||
* Tests the update path base class with the RC1 database dump.
|
||||
*
|
||||
* @group Update
|
||||
*/
|
||||
class UpdatePathRC1TestBaseTest extends UpdatePathTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = ['update_test_schema'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDatabaseDumpFiles() {
|
||||
$this->databaseDumpFiles = [
|
||||
__DIR__ . '/../../../tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the database was properly loaded.
|
||||
*/
|
||||
public function testDatabaseLoaded() {
|
||||
$hook_updates = [
|
||||
'user' => '8000',
|
||||
'node' => '8003',
|
||||
'system' => '8013',
|
||||
];
|
||||
foreach ($hook_updates as $module => $schema) {
|
||||
$this->assertEqual(drupal_get_installed_schema_version($module), $schema, new FormattableMarkup('Module @module schema is @schema', ['@module' => $module, '@schema' => $schema]));
|
||||
}
|
||||
|
||||
// Test post_update key value stores contains a list of the update functions
|
||||
// that have run.
|
||||
$existing_updates = array_count_values(\Drupal::keyValue('post_update')->get('existing_updates'));
|
||||
$expected_updates = [
|
||||
'system_post_update_recalculate_configuration_entity_dependencies',
|
||||
'field_post_update_save_custom_storage_property',
|
||||
'field_post_update_entity_reference_handler_setting',
|
||||
'block_post_update_disable_blocks_with_missing_contexts',
|
||||
'views_post_update_update_cacheability_metadata',
|
||||
];
|
||||
foreach ($expected_updates as $expected_update) {
|
||||
$this->assertEqual($existing_updates[$expected_update], 1, new FormattableMarkup("@expected_update exists in 'existing_updates' key and only appears once.", ['@expected_update' => $expected_update]));
|
||||
}
|
||||
|
||||
// @todo there are no updates to run.
|
||||
// $this->runUpdates();
|
||||
$this->assertEqual(\Drupal::config('system.site')->get('name'), 'Site-Install');
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertText('Site-Install');
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathTestBaseTest.php
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathTestBaseTest.php.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Update;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathTestJavaScriptTest.php
|
||||
* Contains \Drupal\system\Tests\Update\UpdatePathTestJavaScriptTest.php.
|
||||
*/
|
||||
|
||||
namespace Drupal\system\Tests\Update;
|
||||
|
|
|
@ -34,7 +34,7 @@ class UpdatePostUpdateTest extends UpdatePathTestBase {
|
|||
|
||||
// Ensure that normal and post_update updates are merged together on the
|
||||
// selection page.
|
||||
$this->assertRaw('<ul><li>8001 - Normal update_N() function. </li><li>First update.</li><li>Second update.</li><li>Test1 update.</li><li>Test0 update.</li><li>Testing batch processing in post updates update.</li></ul>');
|
||||
$this->assertRaw('<ul><li>8001 - Normal update_N() function. </li><li>First update.</li><li>Second update.</li><li>Test0 update.</li><li>Test1 update.</li><li>Testing batch processing in post updates update.</li></ul>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,8 +58,8 @@ class UpdatePostUpdateTest extends UpdatePathTestBase {
|
|||
$updates = [
|
||||
'update_test_postupdate_post_update_first',
|
||||
'update_test_postupdate_post_update_second',
|
||||
'update_test_postupdate_post_update_test1',
|
||||
'update_test_postupdate_post_update_test0',
|
||||
'update_test_postupdate_post_update_test1',
|
||||
'update_test_postupdate_post_update_test_batch-1',
|
||||
'update_test_postupdate_post_update_test_batch-2',
|
||||
'update_test_postupdate_post_update_test_batch-3',
|
||||
|
|
|
@ -641,15 +641,15 @@ function system_requirements($phase) {
|
|||
$requirements['update']['description'] = t('Some modules have database schema updates to install. You should run the <a href=":update">database update script</a> immediately.', array(':update' => \Drupal::url('system.db_update')));
|
||||
}
|
||||
|
||||
// Verify that no entity updates are pending after running every DB update.
|
||||
if (!isset($requirements['update']['severity']) && \Drupal::entityDefinitionUpdateManager()->needsUpdates()) {
|
||||
$requirements['entity_update'] = array(
|
||||
'title' => t('Entity/field definitions'),
|
||||
'value' => t('Mismatch detected'),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
// @todo Provide details: https://www.drupal.org/node/2554911
|
||||
'description' => t('Mismatched entity and/or field definitions.'),
|
||||
);
|
||||
$requirements['entity_update'] = [
|
||||
'title' => t('Entity/field definitions'),
|
||||
'value' => t('Up to date'),
|
||||
];
|
||||
// Verify that no entity updates are pending.
|
||||
if (\Drupal::entityDefinitionUpdateManager()->needsUpdates()) {
|
||||
$requirements['entity_update']['severity'] = REQUIREMENT_ERROR;
|
||||
// @todo Provide details: https://www.drupal.org/node/2554911
|
||||
$requirements['entity_update']['value'] = t('Mismatched entity and/or field definitions');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
* - configuration: A list of the block's configuration values.
|
||||
* - label: The configured label for the block.
|
||||
* - label_display: The display settings for the label.
|
||||
* - module: The module that provided this block plugin.
|
||||
* - cache: The cache settings.
|
||||
* - provider: The module or other provider that provided this block plugin.
|
||||
* - Block plugin specific settings will also be stored here.
|
||||
* - content: The content of this block.
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
* @file
|
||||
* Default theme implementation of a container used to wrap child elements.
|
||||
*
|
||||
* Used for grouped form items. Can also be used as a #theme_wrapper for any
|
||||
* Used for grouped form items. Can also be used as a theme wrapper for any
|
||||
* renderable element, to surround it with a <div> and HTML attributes.
|
||||
* See the @link forms_api_reference.html Form API reference @endlink for more
|
||||
* information on the #theme_wrappers render array property.
|
||||
*
|
||||
* Available variables:
|
||||
* - attributes: HTML attributes for the containing element.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
#}
|
||||
<table class="system-status-report">
|
||||
<tbody>
|
||||
{% for requirement in requirements %}
|
||||
<tr class="system-status-report__entry system-status-report__entry--{{ requirement.severity_status }} color-{{ requirement.severity_status }}">
|
||||
{% if requirement.severity_status in ['warning', 'error'] %}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\early_rendering_controller_test\AttachmentsTestDomainObject.
|
||||
* Contains \Drupal\early_rendering_controller_test\CacheableTestDomainObject.
|
||||
*/
|
||||
|
||||
namespace Drupal\early_rendering_controller_test;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
services:
|
||||
http_middleware.monkeys:
|
||||
class: Drupal\error_service_test\MonkeysInTheControlRoom
|
||||
arguments: ['@settings']
|
||||
tags:
|
||||
- { name: http_middleware, priority: 400 }
|
||||
# Set up a service with a missing class dependency.
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace Drupal\error_service_test;
|
||||
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
|
@ -29,8 +30,9 @@ class MonkeysInTheControlRoom implements HttpKernelInterface {
|
|||
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $app
|
||||
* The wrapper HTTP kernel.
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $app) {
|
||||
public function __construct(HttpKernelInterface $app, Settings $settings) {
|
||||
$this->app = $app;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +63,20 @@ class MonkeysInTheControlRoom implements HttpKernelInterface {
|
|||
throw new \Exception('Deforestation');
|
||||
}
|
||||
|
||||
return $this->app->handle($request, $type, $catch);
|
||||
if ($this->settings->get('teapots', FALSE) && class_exists('\TypeError')) {
|
||||
try {
|
||||
$return = $this->app->handle($request, $type, $catch);
|
||||
}
|
||||
catch (\TypeError $e) {
|
||||
header('HTTP/1.1 418 I\'m a teapot');
|
||||
print('Oh oh, flying teapots');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$return = $this->app->handle($request, $type, $catch);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\form_test\Form\FormTestGroupContainerForm.
|
||||
* Contains \Drupal\form_test\Form\FormTestDetailsForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\form_test\Form;
|
||||
|
|
|
@ -36,7 +36,7 @@ class TestLazyPluginCollection extends LazyPluginCollection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Component\Plugin\LazyPluginCollection::initializePlugin().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initializePlugin($instance_id) {
|
||||
$this->pluginInstances[$instance_id] = $this->manager->createInstance($instance_id, array());
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\render_attached_test\Controller\TestController.
|
||||
* Contains \Drupal\render_attached_test\Controller\RenderAttachedTestController.
|
||||
*/
|
||||
|
||||
namespace Drupal\render_attached_test\Controller;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\render_attached_test\Plugin\Block\DrupalProcessAttachedBlock.
|
||||
* Contains \Drupal\render_attached_test\Plugin\Block\AttachedRenderingBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\render_attached_test\Plugin\Block;
|
||||
|
|
|
@ -69,7 +69,7 @@ class TestClass implements EventSubscriberInterface, DestructableInterface, Cont
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\DestructableInterface::destruct().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function destruct() {
|
||||
$this->state->set('service_provider_test.destructed', TRUE);
|
||||
|
|
|
@ -13,19 +13,19 @@ use Drupal\file\FileUsage\FileUsageBase;
|
|||
class TestFileUsage extends FileUsageBase {
|
||||
|
||||
/**
|
||||
* Implements Drupal\file\FileUsage\FileUsageInterface::add().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function add(FileInterface $file, $module, $type, $id, $count = 1) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\file\FileUsage\FileUsageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(FileInterface $file, $module, $type = NULL, $id = NULL, $count = 1) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\file\FileUsage\FileUsageInterface::listUsage().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function listUsage(FileInterface $file) {
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
class PathProcessor implements InboundPathProcessorInterface {
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processInbound($path, Request $request) {
|
||||
if (preg_match('!^/user/([^/]+)(/.*)?!', $path, $matches)) {
|
||||
|
|
|
@ -19,7 +19,7 @@ use Drupal\user\Entity\User;
|
|||
class PathProcessorTest implements InboundPathProcessorInterface, OutboundPathProcessorInterface {
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\PathProcessor\InboundPathProcessorInterface::processInbound().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processInbound($path, Request $request) {
|
||||
// Rewrite user/username to user/uid.
|
||||
|
@ -40,7 +40,7 @@ class PathProcessorTest implements InboundPathProcessorInterface, OutboundPathPr
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\PathProcessor\OutboundPathProcessorInterface::processOutbound().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
|
||||
// Rewrite user/uid to user/username.
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
{#
|
||||
/**
|
||||
* @file
|
||||
* Minimal template to ensure chained property access works with white-listing.
|
||||
*/
|
||||
#}
|
||||
<article{{ attributes }}>
|
||||
|
||||
<div>
|
||||
{{ node.field_term.entity.label }}
|
||||
</div>
|
||||
|
||||
</article>
|
|
@ -29,8 +29,13 @@ function test_theme_element_info_alter(&$info) {
|
|||
}
|
||||
}
|
||||
|
||||
function test_theme_library_info_alter(&$libraries) {
|
||||
$libraries['kitten']['js'][] = 'kittens.js';
|
||||
/**
|
||||
* Implements hook_library_info_alter().
|
||||
*/
|
||||
function test_theme_library_info_alter(&$libraries, $extension) {
|
||||
if ($extension === 'test_theme') {
|
||||
$libraries['kitten']['js']['kittens.js'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue