Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes

This commit is contained in:
Pantheon Automation 2016-01-06 16:31:26 -08:00 committed by Greg Anderson
parent 1a0e9d9fac
commit a6b049dd05
538 changed files with 5247 additions and 1594 deletions

View file

@ -78,7 +78,7 @@ function hook_field_storage_config_update_forbid(\Drupal\field\FieldStorageConfi
// Forbid any update that removes allowed values with actual data.
$allowed_values = $field_storage->getSetting('allowed_values');
$prior_allowed_values = $prior_field_storage->getSetting('allowed_values');
$lost_keys = array_keys(array_diff_key($prior_allowed_values,$allowed_values));
$lost_keys = array_keys(array_diff_key($prior_allowed_values, $allowed_values));
if (_options_values_in_use($field_storage->getTargetEntityTypeId(), $field_storage->getName(), $lost_keys)) {
throw new \Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException(t('A list field (@field_name) with existing data cannot have its keys changed.', array('@field_name' => $field_storage->getName())));
}
@ -106,9 +106,9 @@ function hook_field_storage_config_update_forbid(\Drupal\field\FieldStorageConfi
* subclassing \Drupal\Core\Field\WidgetBase). Widget plugins need to be in the
* namespace \Drupal\{your_module}\Plugin\Field\FieldWidget.
*
* Widgets are @link forms_api_reference.html Form API @endlink
* elements with additional processing capabilities. The methods of the
* WidgetInterface object are typically called by respective methods in the
* Widgets are @link form_api Form API @endlink elements with additional
* processing capabilities. The methods of the WidgetInterface object are
* typically called by respective methods in the
* \Drupal\Core\Entity\Entity\EntityFormDisplay class.
*
* @see field

View file

@ -30,7 +30,7 @@ class FieldTypeDefaults extends ProcessPluginBase {
$value = 'datetime_default';
}
else {
throw new MigrateException(sprintf('Failed to lookup %s in the static map.', var_export($value, TRUE)));
throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE)));
}
}
return $value;

View file

@ -34,7 +34,7 @@ class FieldInstancePerFormDisplay extends DrupalSqlBase {
'type',
'module',
))
->condition('fci.entity_type','node');
->condition('fci.entity_type', 'node');
$query->join('field_config', 'fc', 'fci.field_id = fc.id');
return $query;
}

View file

@ -49,7 +49,7 @@ class SqlContentEntityStorageSchemaColumnTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->installEntitySchema('entity_test_rev');

View file

@ -36,7 +36,7 @@ class EntityReferenceFileUploadTest extends WebTestBase {
/**
* Node id.
*
* @var integer
* @var int
*/
protected $nodeId;

View file

@ -62,7 +62,7 @@ class EntityReferenceRelationshipTest extends ViewKernelTestBase {
$this->installEntitySchema('entity_test_mul');
// Create reference from entity_test to entity_test_mul.
$this->createEntityReferenceField('entity_test','entity_test','field_test_data','field_test_data','entity_test_mul');
$this->createEntityReferenceField('entity_test', 'entity_test', 'field_test_data', 'field_test_data', 'entity_test_mul');
// Create reference from entity_test_mul to entity_test.
$this->createEntityReferenceField('entity_test_mul', 'entity_test_mul', 'field_data_test', 'field_data_test', 'entity_test');

View file

@ -36,7 +36,7 @@ class SelectionTest extends WebTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
// Create nodes.

View file

@ -80,8 +80,8 @@ class FieldDataCountTest extends FieldUnitTestBase {
// Create 12 entities to ensure that the purging works as expected.
for ($i=0; $i < 12; $i++) {
$entity = entity_create('entity_test');
$entity->field_int[] = mt_rand(1,99);
$entity->field_int[] = mt_rand(1,99);
$entity->field_int[] = mt_rand(1, 99);
$entity->field_int[] = mt_rand(1, 99);
$entity->name[] = $this->randomMachineName();
$entity->save();
}

View file

@ -35,7 +35,7 @@ class FieldDefaultValueCallbackTest extends WebTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->fieldName = 'field_test';

View file

@ -39,22 +39,22 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
// Integer field.
$field_storage = FieldStorageConfig::load('node.field_test_two');
$this->assertIdentical("integer", $field_storage->getType(), t('Field type is @fieldtype. It should be integer.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("integer", $field_storage->getType(), t('Field type is @fieldtype. It should be integer.', array('@fieldtype' => $field_storage->getType())));
// Float field.
$field_storage = FieldStorageConfig::load('node.field_test_three');
$this->assertIdentical("decimal", $field_storage->getType(), t('Field type is @fieldtype. It should be decimal.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("decimal", $field_storage->getType(), t('Field type is @fieldtype. It should be decimal.', array('@fieldtype' => $field_storage->getType())));
// Link field.
$field_storage = FieldStorageConfig::load('node.field_test_link');
$this->assertIdentical("link", $field_storage->getType(), t('Field type is @fieldtype. It should be link.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("link", $field_storage->getType(), t('Field type is @fieldtype. It should be link.', array('@fieldtype' => $field_storage->getType())));
// File field.
$field_storage = FieldStorageConfig::load('node.field_test_filefield');
$this->assertIdentical("file", $field_storage->getType(), t('Field type is @fieldtype. It should be file.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("file", $field_storage->getType(), t('Field type is @fieldtype. It should be file.', array('@fieldtype' => $field_storage->getType())));
$field_storage = FieldStorageConfig::load('node.field_test_imagefield');
$this->assertIdentical("image", $field_storage->getType(), t('Field type is @fieldtype. It should be image.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("image", $field_storage->getType(), t('Field type is @fieldtype. It should be image.', array('@fieldtype' => $field_storage->getType())));
$settings = $field_storage->getSettings();
$this->assertIdentical('file', $settings['target_type']);
$this->assertIdentical('public', $settings['uri_scheme']);
@ -62,15 +62,15 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
// Phone field.
$field_storage = FieldStorageConfig::load('node.field_test_phone');
$this->assertIdentical("telephone", $field_storage->getType(), t('Field type is @fieldtype. It should be telephone.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("telephone", $field_storage->getType(), t('Field type is @fieldtype. It should be telephone.', array('@fieldtype' => $field_storage->getType())));
// Date field.
$field_storage = FieldStorageConfig::load('node.field_test_datetime');
$this->assertIdentical("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("datetime", $field_storage->getType(), t('Field type is @fieldtype. It should be datetime.', array('@fieldtype' => $field_storage->getType())));
// Decimal field with radio buttons.
$field_storage = FieldStorageConfig::load('node.field_test_decimal_radio_buttons');
$this->assertIdentical("list_float", $field_storage->getType(), t('Field type is @fieldtype. It should be list_float.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("list_float", $field_storage->getType(), t('Field type is @fieldtype. It should be list_float.', array('@fieldtype' => $field_storage->getType())));
$this->assertNotNull($field_storage->getSetting('allowed_values')['1.2'], t('First allowed value key is set to 1.2'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['2.1'], t('Second allowed value key is set to 2.1'));
$this->assertIdentical('1.2', $field_storage->getSetting('allowed_values')['1.2'], t('First allowed value is set to 1.2'));
@ -78,11 +78,11 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
// Float field with a single checkbox.
$field_storage = FieldStorageConfig::load('node.field_test_float_single_checkbox');
$this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType())));
// Integer field with a select list.
$field_storage = FieldStorageConfig::load('node.field_test_integer_selectlist');
$this->assertIdentical("list_integer", $field_storage->getType(), t('Field type is @fieldtype. It should be list_integer.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("list_integer", $field_storage->getType(), t('Field type is @fieldtype. It should be list_integer.', array('@fieldtype' => $field_storage->getType())));
$this->assertNotNull($field_storage->getSetting('allowed_values')['1234'], t('First allowed value key is set to 1234'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['2341'], t('Second allowed value key is set to 2341'));
$this->assertNotNull($field_storage->getSetting('allowed_values')['3412'], t('Third allowed value key is set to 3412'));
@ -94,7 +94,7 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
// Text field with a single checkbox.
$field_storage = FieldStorageConfig::load('node.field_test_text_single_checkbox');
$this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType())));
$this->assertIdentical("boolean", $field_storage->getType(), t('Field type is @fieldtype. It should be boolean.', array('@fieldtype' => $field_storage->getType())));
// Validate that the source count and processed count match up.
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */

View file

@ -53,9 +53,9 @@ class MigrateFieldTest extends MigrateDrupal7TestBase {
* The entity ID in the form ENTITY_TYPE.FIELD_NAME.
* @param string $expected_type
* The expected field type.
* @param boolean $expected_translatable
* @param bool $expected_translatable
* Whether or not the field is expected to be translatable.
* @param integer $expected_cardinality
* @param int $expected_cardinality
* The expected cardinality of the field.
*/
protected function assertEntity($id, $expected_type, $expected_translatable, $expected_cardinality) {

View file

@ -371,8 +371,8 @@ class NumberFieldTest extends WebTestBase {
$decimal_separators = array('.', ',');
$prefix = $this->randomMachineName();
$suffix = $this->randomMachineName();
$random_float = rand(0,pow(10,6));
$random_integer = rand(0, pow(10,6));
$random_float = rand(0, pow(10, 6));
$random_integer = rand(0, pow(10, 6));
// Create a content type containing float and integer fields.
$this->drupalCreateContentType(array('type' => $type));

View file

@ -145,7 +145,7 @@ class TimestampFormatterTest extends KernelTestBase {
protected function testTimestampAgoFormatter() {
$data = [];
foreach (array(1,2,3,4,5,6) as $granularity) {
foreach (array(1, 2, 3, 4, 5, 6) as $granularity) {
$data[] = [
'future_format' => '@interval hence',
'past_format' => '@interval ago',

View file

@ -124,7 +124,7 @@ function field_test_field_widget_form_alter(&$element, FormStateInterface $form_
function field_test_query_efq_table_prefixing_test_alter(&$query) {
// Add an additional join onto the entity base table. This will cause an
// exception if the EFQ does not properly prefix the base table.
$query->join('entity_test','et2','%alias.id = entity_test.id');
$query->join('entity_test', 'et2', '%alias.id = entity_test.id');
}

View file

@ -0,0 +1,59 @@
<?php
/**
* @file
* Contains \Drupal\Tests\field\Unit\Plugin\migrate\process\d6\FieldTypeDefaultsTest.
*/
namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d6;
use Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults;
use Drupal\migrate\MigrateException;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
* Tests D6 fields defaults.
*
* @coversDefaultClass \Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults
* @group field
*/
class FieldTypeDefaultsTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->plugin = new FieldTypeDefaults([], 'field_type_defaults', []);
}
/**
* Tests various default cases.
*
* @covers ::transform
*/
public function testDefaults() {
$this->row->expects($this->once())
->method('getSourceProperty')
->willReturn('date');
// Assert common values are passed through without modification.
$this->assertNull($this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'property'));
$this->assertEquals('string', $this->plugin->transform('string', $this->migrateExecutable, $this->row, 'property'));
$this->assertEquals(1234, $this->plugin->transform(1234, $this->migrateExecutable, $this->row, 'property'));
// Assert that an array checks that this is a date field(above mock assert)
// and returns "datetime_default".
$this->assertEquals('datetime_default', $this->plugin->transform([], $this->migrateExecutable, $this->row, 'property'));
}
/**
* Tests an exception is thrown when the input is not a date field.
*
* @covers ::transform
*/
public function testDefaultsException() {
$this->setExpectedException(MigrateException::class,
sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'property');
}
}