Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -36,4 +36,5 @@ class TestFieldApplicableFormatter extends FormatterBase {
|
|||
public function viewElements(FieldItemListInterface $items, $langcode) {
|
||||
return array('#markup' => 'Nothing to see here');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,4 +66,5 @@ class TestFieldDefaultFormatter extends FormatterBase {
|
|||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,4 +69,5 @@ class TestFieldEmptySettingFormatter extends FormatterBase {
|
|||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,4 +71,5 @@ class TestFieldMultipleFormatter extends FormatterBase {
|
|||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,4 +79,5 @@ class TestFieldPrepareViewFormatter extends FormatterBase {
|
|||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ use Drupal\Core\Field\FieldDefinitionInterface;
|
|||
* }
|
||||
* )
|
||||
*/
|
||||
|
||||
class TestItemWithDependencies extends TestItem {
|
||||
|
||||
/**
|
||||
|
|
|
@ -308,4 +308,5 @@ class DisplayApiTest extends FieldKernelTestBase {
|
|||
// default "empty" text.
|
||||
$this->assertText($display['settings']['test_empty_string']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
|
|||
// Use Classy theme for testing markup output.
|
||||
\Drupal::service('theme_handler')->install(['classy']);
|
||||
\Drupal::service('theme_handler')->setDefault('classy');
|
||||
|
||||
$this->installEntitySchema('entity_test');
|
||||
// Grant the 'view test entity' permission.
|
||||
$this->installConfig(array('user'));
|
||||
Role::load(RoleInterface::ANONYMOUS_ID)
|
||||
|
@ -195,7 +195,7 @@ class EntityReferenceFormatterTest extends EntityKernelTestBase {
|
|||
</div>
|
||||
';
|
||||
$renderer->renderRoot($build[0]);
|
||||
$this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
|
||||
$this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() . $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
|
||||
$expected_cache_tags = Cache::mergeTags(\Drupal::entityManager()->getViewBuilder($this->entityType)->getCacheTags(), $this->referencedEntity->getCacheTags());
|
||||
$expected_cache_tags = Cache::mergeTags($expected_cache_tags, FilterFormat::load('full_html')->getCacheTags());
|
||||
$this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags.', array('@formatter' => $formatter)));
|
||||
|
|
|
@ -370,7 +370,7 @@ class FieldAttachStorageTest extends FieldKernelTestBase {
|
|||
|
||||
// Verify that the fields are gone.
|
||||
$this->assertFalse(FieldConfig::load('entity_test.' . $this->fieldTestData->field->getTargetBundle() . '.' . $this->fieldTestData->field_name), "First field is deleted");
|
||||
$this->assertFalse(FieldConfig::load('entity_test.' . $field['bundle']. '.' . $field_name), "Second field is deleted");
|
||||
$this->assertFalse(FieldConfig::load('entity_test.' . $field['bundle'] . '.' . $field_name), "Second field is deleted");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,4 +48,5 @@ class FieldImportChangeTest extends FieldKernelTestBase {
|
|||
$field = FieldConfig::load($field_id);
|
||||
$this->assertEqual($field->getLabel(), $new_label, 'field label updated');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,4 +115,5 @@ class FieldImportCreateTest extends FieldKernelTestBase {
|
|||
$field = FieldConfig::load($field_id_2b);
|
||||
$this->assertTrue($field, 'Test import field 2b from sync exists');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -108,4 +108,5 @@ class FieldImportDeleteTest extends FieldKernelTestBase {
|
|||
$deleted_storages = \Drupal::state()->get('field.storage.deleted') ?: array();
|
||||
$this->assertTrue(empty($deleted_storages), 'Fields are deleted');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\Tests\field\Kernel;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Extension\ExtensionDiscovery;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\entity_test\Entity\EntityTest;
|
||||
|
||||
|
@ -84,4 +85,41 @@ class FieldTypePluginManagerTest extends FieldKernelTestBase {
|
|||
$this->assertEqual($instance->getFieldDefinition()->getDefaultValue($entity), [['value' => 8675309]], 'Instance default_value is 8675309');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests all field items provide an existing main property.
|
||||
*/
|
||||
public function testMainProperty() {
|
||||
// Let's enable all Drupal modules in Drupal core, so we test any field
|
||||
// type plugin.
|
||||
$this->enableAllCoreModules();
|
||||
|
||||
/** @var \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager */
|
||||
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
|
||||
foreach ($field_type_manager->getDefinitions() as $plugin_id => $definition) {
|
||||
$class = $definition['class'];
|
||||
$property = $class::mainPropertyName();
|
||||
$storage_definition = BaseFieldDefinition::create($plugin_id);
|
||||
$property_definitions = $class::propertyDefinitions($storage_definition);
|
||||
$properties = implode(', ', array_keys($property_definitions));
|
||||
if (!empty($property_definitions)) {
|
||||
$message = sprintf("%s property %s found in %s", $plugin_id, $property, $properties);
|
||||
$this->assertArrayHasKey($property, $class::propertyDefinitions($storage_definition), $message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable all core modules.
|
||||
*/
|
||||
protected function enableAllCoreModules() {
|
||||
$listing = new ExtensionDiscovery(\Drupal::root());
|
||||
$module_list = $listing->scan('module', FALSE);
|
||||
/** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
|
||||
$module_handler = $this->container->get('module_handler');
|
||||
$module_list = array_filter(array_keys($module_list), function ($module) use ($module_handler, $module_list) {
|
||||
return !$module_handler->moduleExists($module) && substr($module_list[$module]->getPath(), 0, 4) === 'core';
|
||||
});
|
||||
$this->enableModules($module_list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
static $modules = array(
|
||||
public static $modules = array(
|
||||
'comment',
|
||||
'datetime',
|
||||
'file',
|
||||
|
@ -76,7 +76,7 @@ class MigrateFieldInstanceTest extends MigrateDrupal7TestBase {
|
|||
* The expected field label.
|
||||
* @param string $expected_field_type
|
||||
* The expected field type.
|
||||
* @param boolean $is_required
|
||||
* @param bool $is_required
|
||||
* Whether or not the field is required.
|
||||
*/
|
||||
protected function assertEntity($id, $expected_label, $expected_field_type, $is_required) {
|
||||
|
|
|
@ -18,7 +18,7 @@ class MigrateFieldTest extends MigrateDrupal7TestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
static $modules = array(
|
||||
public static $modules = array(
|
||||
'comment',
|
||||
'datetime',
|
||||
'file',
|
||||
|
|
|
@ -156,4 +156,5 @@ class StringFormatterTest extends KernelTestBase {
|
|||
$this->assertLink($value, 0);
|
||||
$this->assertLinkByHref('/entity_test_rev/' . $entity_new_revision->id() . '/revision/' . $entity_new_revision->getRevisionId() . '/view');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,4 +51,5 @@ class FieldTypeDefaultsTest extends MigrateProcessTestCase {
|
|||
sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'property');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue