Update to Drupal 8.0.5. For more information, see https://www.drupal.org/node/2679347
This commit is contained in:
parent
2a9f1f148d
commit
fd3b12cf27
251 changed files with 5439 additions and 957 deletions
|
@ -36,4 +36,12 @@ class Callbacks {
|
|||
$response->addCommand(new DataCommand('#ajax_checkbox_value', 'form_state_value_select', (int) $form_state->getValue('checkbox')));
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback triggered by the checkbox in a #group.
|
||||
*/
|
||||
function checkboxGroupCallback($form, FormStateInterface $form_state) {
|
||||
return $form['checkbox_in_group_wrapper'];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -72,6 +72,48 @@ class AjaxFormsTestSimpleForm extends FormBase {
|
|||
);
|
||||
}
|
||||
|
||||
$form['test_group'] = [
|
||||
'#type' => 'details',
|
||||
'#title' => $this->t('Test group'),
|
||||
'#open' => TRUE,
|
||||
];
|
||||
|
||||
// Test ajax element in a #group.
|
||||
$form['checkbox_in_group_wrapper'] = [
|
||||
'#type' => 'container',
|
||||
'#attributes' => ['id' => 'checkbox-wrapper'],
|
||||
'#group' => 'test_group',
|
||||
'checkbox_in_group' => [
|
||||
'#type' => 'checkbox',
|
||||
'#title' => $this->t('AJAX checkbox in a group'),
|
||||
'#ajax' => [
|
||||
'callback' => [$object, 'checkboxGroupCallback'],
|
||||
'wrapper' => 'checkbox-wrapper',
|
||||
],
|
||||
],
|
||||
'nested_group' => [
|
||||
'#type' => 'details',
|
||||
'#title' => $this->t('Nested group'),
|
||||
'#open' => TRUE,
|
||||
],
|
||||
'checkbox_in_nested' => [
|
||||
'#type' => 'checkbox',
|
||||
'#group' => 'nested_group',
|
||||
'#title' => $this->t('AJAX checkbox in a nested group'),
|
||||
'#ajax' => [
|
||||
'callback' => [$object, 'checkboxGroupCallback'],
|
||||
'wrapper' => 'checkbox-wrapper',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$form['another_checkbox_in_nested'] = [
|
||||
'#type' => 'checkbox',
|
||||
'#group' => 'nested_group',
|
||||
'#title' => $this->t('Another AJAX checkbox in a nested group'),
|
||||
];
|
||||
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
|
|
@ -384,10 +384,13 @@ function entity_test_entity_field_access($operation, FieldDefinitionInterface $f
|
|||
if ($field_definition->getName() == 'field_test_text') {
|
||||
if ($items) {
|
||||
if ($items->value == 'no access value') {
|
||||
return AccessResult::forbidden()->cacheUntilEntityChanges($items->getEntity());
|
||||
return AccessResult::forbidden()->addCacheableDependency($items->getEntity());
|
||||
}
|
||||
elseif ($items->value == 'custom cache tag value') {
|
||||
return AccessResult::allowed()->addCacheableDependency($items->getEntity())->addCacheTags(['entity_test_access:field_test_text']);
|
||||
}
|
||||
elseif ($operation == 'edit' && $items->value == 'no edit access value') {
|
||||
return AccessResult::forbidden()->cacheUntilEntityChanges($items->getEntity());
|
||||
return AccessResult::forbidden()->addCacheableDependency($items->getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -471,6 +474,13 @@ function entity_test_entity_operation_alter(array &$operations, EntityInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_translation_create().
|
||||
*/
|
||||
function entity_test_entity_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_translation_insert().
|
||||
*/
|
||||
|
@ -485,6 +495,13 @@ function entity_test_entity_translation_delete(EntityInterface $translation) {
|
|||
_entity_test_record_hooks('entity_translation_delete', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mul'.
|
||||
*/
|
||||
function entity_test_entity_test_mul_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mul_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mul'.
|
||||
*/
|
||||
|
@ -500,7 +517,14 @@ function entity_test_entity_test_mul_translation_delete(EntityInterface $transla
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mulrev'.
|
||||
* Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mul_changed'.
|
||||
*/
|
||||
function entity_test_entity_test_mul_changed_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mul_changed_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mul_changed'.
|
||||
*/
|
||||
function entity_test_entity_test_mul_changed_translation_insert(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mul_changed_translation_insert', $translation->language()->getId());
|
||||
|
@ -513,6 +537,13 @@ function entity_test_entity_test_mul_changed_translation_delete(EntityInterface
|
|||
_entity_test_record_hooks('entity_test_mul_changed_translation_delete', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_create().
|
||||
*/
|
||||
function entity_test_entity_test_mulrev_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mulrev_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert().
|
||||
*/
|
||||
|
@ -527,6 +558,13 @@ function entity_test_entity_test_mulrev_translation_delete(EntityInterface $tran
|
|||
_entity_test_record_hooks('entity_test_mulrev_translation_delete', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mulrev_changed'.
|
||||
*/
|
||||
function entity_test_entity_test_mulrev_changed_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mulrev_changed_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mulrev'.
|
||||
*/
|
||||
|
@ -541,6 +579,13 @@ function entity_test_entity_test_mulrev_changed_translation_delete(EntityInterfa
|
|||
_entity_test_record_hooks('entity_test_mulrev_changed_translation_delete', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mul_langcode_key'.
|
||||
*/
|
||||
function entity_test_entity_test_mul_langcode_key_translation_create(EntityInterface $translation) {
|
||||
_entity_test_record_hooks('entity_test_mul_langcode_key_translation_create', $translation->language()->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mul_langcode_key'.
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\Extension\ModuleHandlerTest.
|
||||
* Contains \Drupal\Tests\system\Kernel\Extension\ModuleHandlerTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\system\Kernel\Extension;
|
||||
|
|
62
core/modules/system/tests/src/Kernel/PathHooksTest.php
Normal file
62
core/modules/system/tests/src/Kernel/PathHooksTest.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\system\Kernel\PathHooksTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\system\Kernel;
|
||||
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Path\AliasManagerInterface;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Prophecy\Argument;
|
||||
|
||||
/**
|
||||
* @group Drupal
|
||||
*/
|
||||
class PathHooksTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
static public $modules = ['system'];
|
||||
|
||||
/**
|
||||
* Test system_path_*() correctly clears caches.
|
||||
*/
|
||||
public function testPathHooks() {
|
||||
$this->installSchema('system', ['url_alias']);
|
||||
|
||||
$source = '/' . $this->randomMachineName();
|
||||
$alias = '/' . $this->randomMachineName();
|
||||
|
||||
// Check system_path_insert();
|
||||
$alias_manager = $this->prophesize(AliasManagerInterface::class);
|
||||
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1);
|
||||
$alias_manager->cacheClear($source)->shouldBeCalledTimes(1);
|
||||
\Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal());
|
||||
$alias_storage = \Drupal::service('path.alias_storage');
|
||||
$alias_storage->save($source, $alias);
|
||||
|
||||
$new_source = '/' . $this->randomMachineName();
|
||||
$path = $alias_storage->load(['source' => $source]);
|
||||
|
||||
// Check system_path_update();
|
||||
$alias_manager = $this->prophesize(AliasManagerInterface::class);
|
||||
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(2);
|
||||
$alias_manager->cacheClear($source)->shouldBeCalledTimes(1);
|
||||
$alias_manager->cacheClear($new_source)->shouldBeCalledTimes(1);
|
||||
\Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal());
|
||||
$alias_storage->save($new_source, $alias, LanguageInterface::LANGCODE_NOT_SPECIFIED, $path['pid']);
|
||||
|
||||
// Check system_path_delete();
|
||||
$alias_manager = $this->prophesize(AliasManagerInterface::class);
|
||||
$alias_manager->cacheClear(Argument::any())->shouldBeCalledTimes(1);
|
||||
$alias_manager->cacheClear($new_source)->shouldBeCalledTimes(1);
|
||||
\Drupal::getContainer()->set('path.alias_manager', $alias_manager->reveal());
|
||||
$alias_storage->delete(['pid' => $path['pid']]);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\system\Tests\PhpStorage\PhpStorageFactoryTest.
|
||||
* Contains \Drupal\Tests\system\Kernel\PhpStorage\PhpStorageFactoryTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\system\Kernel\PhpStorage;
|
||||
|
|
|
@ -57,6 +57,7 @@ class DbDumpCommandTest extends KernelTestBase {
|
|||
$this->assertContains("'name' => 'test", $output, 'Insert name field found');
|
||||
$this->assertContains("'path' => 'test", $output, 'Insert path field found');
|
||||
$this->assertContains("'pattern_outline' => 'test", $output, 'Insert pattern_outline field found');
|
||||
$this->assertContains("// @codingStandardsIgnoreFile", $output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
name: 'Theme test with valid base theme but no grandparent base theme'
|
||||
type: theme
|
||||
description: 'Test theme which has a non-existent base theme in the base chain.'
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
base theme: test_invalid_basetheme
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Test preprocess functions for theme test_stable.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_theme_test_render_element().
|
||||
*/
|
||||
function test_stable_preprocess_theme_test_render_element($variables) {
|
||||
// This is used for Drupal\Tests\Core\Theme\RegistryTest.
|
||||
}
|
Reference in a new issue