Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -5,4 +5,4 @@ core: 8.x
package: Testing
version: VERSION
dependencies:
- entity_test
- drupal:entity_test

View file

@ -28,9 +28,9 @@ class FieldLayoutTest extends BrowserTestBase {
$this->createNode([
'type' => 'article',
'title' => 'The node title',
'body' => [[
'value' => 'The node body',
]],
'body' => [
['value' => 'The node body'],
],
]);
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',

View file

@ -3,14 +3,14 @@
namespace Drupal\Tests\field_layout\FunctionalJavascript;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests using field layout for entity displays.
*
* @group field_layout
*/
class FieldLayoutTest extends JavascriptTestBase {
class FieldLayoutTest extends WebDriverTestBase {
/**
* {@inheritdoc}
@ -25,9 +25,9 @@ class FieldLayoutTest extends JavascriptTestBase {
$entity = EntityTest::create([
'name' => 'The name for this entity',
'field_test_text' => [[
'value' => 'The field test text value',
]],
'field_test_text' => [
['value' => 'The field test text value'],
],
]);
$entity->save();
$this->drupalLogin($this->drupalCreateUser([
@ -100,12 +100,15 @@ class FieldLayoutTest extends JavascriptTestBase {
// After a refresh the new regions are still there.
$this->drupalGet('entity_test/structure/entity_test/form-display');
$this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
$this->assertSession()->waitForElement('css', '.tabledrag-handle');
$id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
// Drag the field to the second region.
$field_test_text_row = $this->getSession()->getPage()->find('css', '#field-test-text');
$second_region_row = $this->getSession()->getPage()->find('css', '.region-second-message');
$field_test_text_row->find('css', '.handle')->dragTo($second_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
@ -158,6 +161,8 @@ class FieldLayoutTest extends JavascriptTestBase {
// After a refresh the new regions are still there.
$this->drupalGet('entity_test/structure/entity_test/display');
$this->assertEquals(['Top', 'First', 'Second', 'Bottom', 'Disabled'], $this->getRegionTitles());
$this->assertSession()->waitForElement('css', '.tabledrag-handle');
$id = $this->getSession()->getPage()->find('css', '[name="form_build_id"]')->getValue();
// Drag the field to the first region.
$this->assertTrue($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
@ -166,6 +171,7 @@ class FieldLayoutTest extends JavascriptTestBase {
$field_test_text_row->find('css', '.handle')->dragTo($first_region_row);
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertFalse($this->assertSession()->optionExists('fields[field_test_text][region]', 'hidden')->isSelected());
$this->assertSession()->waitForElement('css', "[name='form_build_id']:not([value='$id'])");
$this->submitForm([], 'Save');
$this->assertSession()->pageTextContains('Your settings have been saved.');
@ -233,6 +239,40 @@ class FieldLayoutTest extends JavascriptTestBase {
$this->assertSession()->pageTextContains('Blah: Test text');
}
/**
* Tests changing the formatter and region at the same time.
*/
public function testChangingFormatterAndRegion() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
// Add the test field to the content region.
$this->drupalGet('entity_test/structure/entity_test/display');
$page->find('css', '#field-test-text .handle')->dragTo($page->find('css', '.region-content-message'));
$assert_session->assertWaitOnAjaxRequest();
$page->pressButton('Save');
$assert_session->fieldValueEquals('fields[field_test_text][region]', 'content');
$assert_session->fieldValueEquals('fields[field_test_text][type]', 'text_default');
// Switch the layout to two columns.
$this->click('#edit-field-layouts');
$page->selectFieldOption('field_layout', 'layout_twocol');
$assert_session->assertWaitOnAjaxRequest();
$page->pressButton('Save');
$assert_session->fieldValueEquals('fields[field_test_text][region]', 'first');
// Change the formatter and move to another region.
$page->selectFieldOption('fields[field_test_text][type]', 'text_trimmed');
$assert_session->assertWaitOnAjaxRequest();
$page->find('css', '#field-test-text .handle')->dragTo($page->find('css', '.region-second-message'));
$assert_session->assertWaitOnAjaxRequest();
$page->pressButton('Save');
// Assert that both the formatter and region change are persisted.
$assert_session->fieldValueEquals('fields[field_test_text][region]', 'second');
$assert_session->fieldValueEquals('fields[field_test_text][type]', 'text_trimmed');
}
/**
* Gets the region titles on the page.
*

View file

@ -0,0 +1,29 @@
<?php
namespace Drupal\Tests\field_layout\Kernel;
use Drupal\Tests\layout_builder\Kernel\LayoutBuilderCompatibilityTestBase;
/**
* @group field_layout
*/
class FieldLayoutUninstallTest extends LayoutBuilderCompatibilityTestBase {
/**
* Ensures field layout can be uninstalled with layout builder enabled.
*/
public function testFieldLayoutUninstall() {
// Setup user schema so user hook uninstall hook doesn't break.
$this->installSchema('user', 'users_data');
// Setup layout builder and same displays.
$this->installLayoutBuilder();
// Ensure install hook can handle displays without a layout.
$this->container->get('module_installer')->install(['field_layout']);
// Ensure uninstall hook can handle displays without a layout.
$this->container->get('module_installer')->uninstall(['field_layout']);
}
}

View file

@ -93,6 +93,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
'test1' => [
'#markup' => 'Test1',
],
'test2' => [
'#markup' => 'Test2',
],
'non_configurable_field' => [
'#markup' => 'Non-configurable',
],
@ -111,6 +114,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
'test1' => [
'region' => 'right',
],
'test2' => [
'region' => 'unknown_region',
],
'non_configurable_field' => [
'region' => 'left',
],
@ -120,6 +126,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
]);
$expected = [
'test2' => [
'#markup' => 'Test2',
],
'non_configurable_field' => [
'#markup' => 'Non-configurable',
],
@ -169,6 +178,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
'#markup' => 'Test2',
'#group' => 'existing_group',
],
'test3' => [
'#markup' => 'Test3',
],
'field_layout' => [
'#markup' => 'Field created through the UI happens to be named "Layout"',
],
@ -190,6 +202,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
'test2' => [
'region' => 'left',
],
'test3' => [
'region' => 'unknown_region',
],
'field_layout' => [
'region' => 'right',
],
@ -207,6 +222,9 @@ class FieldLayoutBuilderTest extends UnitTestCase {
'#markup' => 'Test2',
'#group' => 'existing_group',
],
'test3' => [
'#markup' => 'Test3',
],
'field_layout' => [
'#markup' => 'Field created through the UI happens to be named "Layout"',
'#group' => 'right',