update drupal

This commit is contained in:
Tessier
2020-10-15 11:59:37 +02:00
parent ebb5db14b5
commit d8b9162932
558 changed files with 5954 additions and 4475 deletions
@@ -67,6 +67,39 @@ class LayoutBuilderTest extends BrowserTestBase {
]);
}
/**
* Tests deleting a field in-use by an overridden layout.
*/
public function testDeleteField() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->drupalLogin($this->drupalCreateUser([
'configure any layout',
'administer node fields',
]));
// Enable layout builder overrides.
LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
->enableLayoutBuilder()
->setOverridable()
->save();
// Ensure there is a layout override.
$this->drupalGet('node/1/layout');
$page->pressButton('Save layout');
// Delete one of the fields in use.
$this->drupalGet('admin/structure/types/manage/bundle_with_section_field/fields/node.bundle_with_section_field.body/delete');
$page->pressButton('Delete');
// The node should still be accessible.
$this->drupalGet('node/1');
$assert_session->statusCodeEquals(200);
$this->drupalGet('node/1/layout');
$assert_session->statusCodeEquals(200);
}
/**
* Tests Layout Builder overrides without access to edit the default layout.
*/
@@ -463,23 +463,16 @@ class LayoutBuilderTest extends WebDriverTestBase {
*
* @param string $expected_form_id
* The expected form ID.
* @param int $timeout
* (Optional) Timeout in milliseconds, defaults to 10000.
*/
private function assertOffCanvasFormAfterWait($expected_form_id, $timeout = 10000) {
$page = $this->getSession()->getPage();
private function assertOffCanvasFormAfterWait($expected_form_id) {
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertNotEmpty($page->waitFor($timeout / 1000, function () use ($page, $expected_form_id) {
// Ensure the form ID exists, is visible, and has the correct value.
$form_id_element = $page->find('hidden_field_selector', ['hidden_field', 'form_id']);
// Ensure the off canvas dialog is visible.
$off_canvas = $page->find('css', '#drupal-off-canvas');
if (!$off_canvas || !$off_canvas->isVisible()) {
return NULL;
}
return $form_id_element;
}));
$off_canvas = $this->assertSession()->waitForElementVisible('css', '#drupal-off-canvas');
$this->assertNotNull($off_canvas);
$form_id_element = $off_canvas->find('hidden_field_selector', ['hidden_field', 'form_id']);
// Ensure the form ID has the correct value and that the form is visible.
$this->assertNotEmpty($form_id_element);
$this->assertSame($expected_form_id, $form_id_element->getValue());
$this->assertTrue($form_id_element->getParent()->isVisible());
}
/**
@@ -545,7 +545,7 @@ class OverridesSectionStorageTest extends UnitTestCase {
$collection = new RouteCollection();
// Entity types that declare a link template for canonical must have a
// canonical route present in the route colletion.
// canonical route present in the route collection.
$collection->add('entity.from_canonical.canonical', $expected['entity.from_canonical.canonical']);
$collection->add('entity.with_string_id.canonical', $expected['entity.with_string_id.canonical']);
$collection->add('entity.with_integer_id.canonical', $expected['entity.with_integer_id.canonical']);
@@ -314,42 +314,42 @@ class SectionTest extends UnitTestCase {
* @covers ::unsetThirdPartySetting
* @dataProvider providerTestUnsetThirdPartySetting
*/
public function testUnsetThirdPartySetting() {
$this->section->unsetThirdPartySetting('bad_judgement', 'blink_speed');
$this->assertSame(['spin_direction' => 'clockwise'], $this->section->getThirdPartySettings('bad_judgement'));
$this->section->unsetThirdPartySetting('hunt_and_peck', 'delay');
$this->assertSame([], $this->section->getThirdPartySettings('hunt_and_peck'));
$this->section->unsetThirdPartySetting('bad_judgement', 'non_existing_key');
$this->section->unsetThirdPartySetting('non_existing_provider', 'non_existing_key');
public function testUnsetThirdPartySetting($provider, $key, $expected) {
$this->section->unsetThirdPartySetting($provider, $key);
$this->assertSame($expected, $this->section->getThirdPartySettings($provider));
}
/**
* Provides test data for ::testUnsetThirdPartySettings().
* Provides test data for ::testUnsetThirdPartySetting().
*/
public function providerTestUnsetThirdPartySetting() {
$data = [];
$data[] = [
$data['Key with values'] = [
'bad_judgement',
'blink_speed',
[
'spin_direction' => 'clockwise',
],
];
$data[] = [
$data['Key without values'] = [
'hunt_and_peck',
'delay',
[],
];
$data[] = [
$data['Non-existing key'] = [
'bad_judgement',
'non_existing_key',
[],
[
'blink_speed' => 'fast',
'spin_direction' => 'clockwise',
],
];
$data[] = [
$data['Non-existing provider'] = [
'non_existing_provider',
'non_existing_key',
[],
];
return $data;
}