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

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Access\ContentTranslationManageAccessCheck.
*/
namespace Drupal\content_translation\Access;
use Drupal\Core\Access\AccessResult;
@ -81,7 +76,7 @@ class ContentTranslationManageAccessCheck implements AccessInterface {
// Translation operations cannot be performed on the default
// translation.
if ($language->getId() == $entity->getUntranslated()->language()->getId()) {
return AccessResult::forbidden()->cacheUntilEntityChanges($entity);
return AccessResult::forbidden()->addCacheableDependency($entity);
}
// Editors have no access to the translation operations, as entity
// access already grants them an equal or greater access level.
@ -110,7 +105,7 @@ class ContentTranslationManageAccessCheck implements AccessInterface {
&& isset($languages[$source_language->getId()])
&& isset($languages[$target_language->getId()])
&& !isset($translations[$target_language->getId()]));
return AccessResult::allowedIf($is_new_translation)->cachePerPermissions()->cacheUntilEntityChanges($entity)
return AccessResult::allowedIf($is_new_translation)->cachePerPermissions()->addCacheableDependency($entity)
->andIf($handler->getTranslationAccess($entity, $operation));
case 'delete':
@ -118,7 +113,7 @@ class ContentTranslationManageAccessCheck implements AccessInterface {
$has_translation = isset($languages[$language->getId()])
&& $language->getId() != $entity->getUntranslated()->language()->getId()
&& isset($translations[$language->getId()]);
return AccessResult::allowedIf($has_translation)->cachePerPermissions()->cacheUntilEntityChanges($entity)
return AccessResult::allowedIf($has_translation)->cachePerPermissions()->addCacheableDependency($entity)
->andIf($handler->getTranslationAccess($entity, $operation));
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Access\ContentTranslationOverviewAccess.
*/
namespace Drupal\content_translation\Access;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationHandler.
*/
namespace Drupal\content_translation;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationHandlerInterface.
*/
namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationManager.
*/
namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationManagerInterface.
*/
namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationMetadataWrapper.
*/
namespace Drupal\content_translation;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationMetadataWrapperInterface.
*/
namespace Drupal\content_translation;
use Drupal\user\UserInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationPermissions.
*/
namespace Drupal\content_translation;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\ContentTranslationUpdatesManager.
*/
namespace Drupal\content_translation;
use Drupal\Core\Config\ConfigEvents;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Controller\ContentTranslationController.
*/
namespace Drupal\content_translation\Controller;
use Drupal\content_translation\ContentTranslationManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\FieldTranslationSynchronizer.
*/
namespace Drupal\content_translation;
use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\FieldTranslationSynchronizerInterface.
*/
namespace Drupal\content_translation;
use Drupal\Core\Entity\ContentEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Form\ContentTranslationDeleteForm.
*/
namespace Drupal\content_translation\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Plugin\Derivative\ContentTranslationContextualLinks.
*/
namespace Drupal\content_translation\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Plugin\Derivative\ContentTranslationLocalTasks.
*/
namespace Drupal\content_translation\Plugin\Derivative;
use Drupal\content_translation\ContentTranslationManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Plugin\views\field\TranslationLink.
*/
namespace Drupal\content_translation\Plugin\views\field;
use Drupal\views\Plugin\views\field\EntityLink;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Routing\ContentTranslationRouteSubscriber.
*/
namespace Drupal\content_translation\Routing;
use Drupal\content_translation\ContentTranslationManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTestTranslationUITest.
*/
namespace Drupal\content_translation\Tests;
/**

View file

@ -1,111 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationConfigImportTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\StorageComparer;
use Drupal\simpletest\KernelTestBase;
/**
* Tests content translation updates performed during config import.
*
* @group content_translation
*/
class ContentTranslationConfigImportTest extends KernelTestBase {
/**
* Config Importer object used for testing.
*
* @var \Drupal\Core\Config\ConfigImporter
*/
protected $configImporter;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('system', 'user', 'entity_test', 'language', 'content_translation');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('entity_test_mul');
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
// Set up the ConfigImporter object for testing.
$storage_comparer = new StorageComparer(
$this->container->get('config.storage.sync'),
$this->container->get('config.storage'),
$this->container->get('config.manager')
);
$this->configImporter = new ConfigImporter(
$storage_comparer->createChangelist(),
$this->container->get('event_dispatcher'),
$this->container->get('config.manager'),
$this->container->get('lock'),
$this->container->get('config.typed'),
$this->container->get('module_handler'),
$this->container->get('module_installer'),
$this->container->get('theme_handler'),
$this->container->get('string_translation')
);
}
/**
* Tests config import updates.
*/
function testConfigImportUpdates() {
$entity_type_id = 'entity_test_mul';
$config_id = $entity_type_id . '.' . $entity_type_id;
$config_name = 'language.content_settings.' . $config_id;
$storage = $this->container->get('config.storage');
$sync = $this->container->get('config.storage.sync');
// Verify the configuration to create does not exist yet.
$this->assertIdentical($storage->exists($config_name), FALSE, $config_name . ' not found.');
// Create new config entity.
$data = array(
'uuid' => 'a019d89b-c4d9-4ed4-b859-894e4e2e93cf',
'langcode' => 'en',
'status' => TRUE,
'dependencies' => array(
'module' => array('content_translation')
),
'id' => $config_id,
'target_entity_type_id' => 'entity_test_mul',
'target_bundle' => 'entity_test_mul',
'default_langcode' => 'site_default',
'language_alterable' => FALSE,
'third_party_settings' => array(
'content_translation' => array('enabled' => TRUE),
),
);
$sync->write($config_name, $data);
$this->assertIdentical($sync->exists($config_name), TRUE, $config_name . ' found.');
// Import.
$this->configImporter->reset()->import();
// Verify the values appeared.
$config = $this->config($config_name);
$this->assertIdentical($config->get('id'), $config_id);
// Verify that updates were performed.
$entity_type = $this->container->get('entity.manager')->getDefinition($entity_type_id);
$table = $entity_type->getDataTable();
$db_schema = $this->container->get('database')->schema();
$result = $db_schema->fieldExists($table, 'content_translation_source') && $db_schema->fieldExists($table, 'content_translation_outdated');
$this->assertTrue($result, 'Content translation updates were successfully performed during config import.');
}
}

View file

@ -1,16 +1,12 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationContextualLinksTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Component\Serialization\Json;
use Drupal\field\Entity\FieldConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\node\Entity\NodeType;
use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Tests that contextual links are available for content translation.
@ -29,7 +25,7 @@ class ContentTranslationContextualLinksTest extends WebTestBase {
/**
* The content type being tested.
*
* @var NodeType
* @var \Drupal\node\Entity\NodeType
*/
protected $contentType;
@ -72,18 +68,18 @@ class ContentTranslationContextualLinksTest extends WebTestBase {
$this->contentType = $this->drupalCreateContentType(array('type' => $this->bundle));
// Add a field to the content type. The field is not yet translatable.
entity_create('field_storage_config', array(
FieldStorageConfig::create(array(
'field_name' => 'field_test_text',
'entity_type' => 'node',
'type' => 'text',
'cardinality' => 1,
))->save();
entity_create('field_config', array(
FieldConfig::create([
'entity_type' => 'node',
'field_name' => 'field_test_text',
'bundle' => $this->bundle,
'label' => 'Test text-field',
))->save();
])->save();
entity_get_form_display('node', $this->bundle, 'default')
->setComponent('field_test_text', array(
'type' => 'text_textfield',

View file

@ -1,16 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationEnableTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Test enabling content translation after other modules.
* Test enabling content translation module.
*
* @group content_translation
*/
@ -34,6 +29,10 @@ class ContentTranslationEnableTest extends WebTestBase {
];
$this->drupalPostForm('admin/modules', $edit, t('Install'));
// Status messages are shown.
$this->assertText(t('This site has only a single language enabled. Add at least one more language in order to translate content.'));
$this->assertText(t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.'));
// No pending updates should be available.
$this->drupalGet('admin/reports/status');
$requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td");

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationEntityBundleUITest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\WebTestBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationMetadataFieldsTest.
*/
namespace Drupal\content_translation\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationOperationsTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\language\Entity\ConfigurableLanguage;

View file

@ -1,45 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSettingsApiTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\KernelTestBase;
/**
* Tests the content translation settings API.
*
* @group content_translation
*/
class ContentTranslationSettingsApiTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('language', 'content_translation', 'user', 'entity_test');
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('entity_test_mul');
}
/**
* Tests that enabling translation via the API triggers schema updates.
*/
function testSettingsApi() {
$this->container->get('content_translation.manager')->setEnabled('entity_test_mul', 'entity_test_mul', TRUE);
$result =
db_field_exists('entity_test_mul_property_data', 'content_translation_source') &&
db_field_exists('entity_test_mul_property_data', 'content_translation_outdated');
$this->assertTrue($result, 'Schema updates correctly performed.');
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSettingsTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationStandardFieldsTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\WebTestBase;

View file

@ -1,13 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSyncImageTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Core\Entity\EntityInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\file\Entity\File;
/**
* Tests the field synchronization behavior for the image field.
@ -49,14 +47,14 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
$this->fieldName = 'field_test_et_ui_image';
$this->cardinality = 3;
entity_create('field_storage_config', array(
FieldStorageConfig::create(array(
'field_name' => $this->fieldName,
'entity_type' => $this->entityTypeId,
'type' => 'image',
'cardinality' => $this->cardinality,
))->save();
entity_create('field_config', array(
FieldConfig::create([
'entity_type' => $this->entityTypeId,
'field_name' => $this->fieldName,
'bundle' => $this->entityTypeId,
@ -70,7 +68,7 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
),
),
),
))->save();
])->save();
}
/**
@ -137,7 +135,7 @@ class ContentTranslationSyncImageTest extends ContentTranslationTestBase {
'uid' => \Drupal::currentUser()->id(),
'status' => FILE_STATUS_PERMANENT,
);
$file = entity_create('file', $field_values);
$file = File::create($field_values);
$file->save();
$fid = $file->id();
$this->files[$index]->fid = $fid;

View file

@ -1,257 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationSyncUnitTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\KernelTestBase;
use Drupal\content_translation\FieldTranslationSynchronizer;
/**
* Tests the field synchronization logic.
*
* @group content_translation
*/
class ContentTranslationSyncUnitTest extends KernelTestBase {
/**
* The synchronizer class to be tested.
*
* @var \Drupal\content_translation\FieldTranslationSynchronizer
*/
protected $synchronizer;
/**
* The columns to be synchronized.
*
* @var array
*/
protected $synchronized;
/**
* All the field columns.
*
* @var array
*/
protected $columns;
/**
* The available language codes.
*
* @var array
*/
protected $langcodes;
/**
* The field cardinality.
*
* @var int
*/
protected $cardinality;
/**
* The unchanged field values.
*
* @var array
*/
protected $unchangedFieldValues;
public static $modules = array('language', 'content_translation');
protected function setUp() {
parent::setUp();
$this->synchronizer = new FieldTranslationSynchronizer($this->container->get('entity.manager'));
$this->synchronized = array('sync1', 'sync2');
$this->columns = array_merge($this->synchronized, array('var1', 'var2'));
$this->langcodes = array('en', 'it', 'fr', 'de', 'es');
$this->cardinality = 4;
$this->unchangedFieldValues = array();
// Set up an initial set of values in the correct state, that is with
// "synchronized" values being equal.
foreach ($this->langcodes as $langcode) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
$sync = in_array($column, $this->synchronized) && $langcode != $this->langcodes[0];
$value = $sync ? $this->unchangedFieldValues[$this->langcodes[0]][$delta][$column] : $langcode . '-' . $delta . '-' . $column;
$this->unchangedFieldValues[$langcode][$delta][$column] = $value;
}
}
}
}
/**
* Tests the field synchronization algorithm.
*/
public function testFieldSync() {
// Add a new item to the source items and check that its added to all the
// translations.
$sync_langcode = $this->langcodes[2];
$unchanged_items = $this->unchangedFieldValues[$sync_langcode];
$field_values = $this->unchangedFieldValues;
$item = array();
foreach ($this->columns as $column) {
$item[$column] = $this->randomMachineName();
}
$field_values[$sync_langcode][] = $item;
$this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
$result = TRUE;
foreach ($this->unchangedFieldValues as $langcode => $items) {
// Check that the old values are still in place.
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
$result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] == $field_values[$langcode][$delta][$column]);
}
}
// Check that the new item is available in all languages.
foreach ($this->columns as $column) {
$result = $result && ($field_values[$langcode][$delta][$column] == $field_values[$sync_langcode][$delta][$column]);
}
}
$this->assertTrue($result, 'A new item has been correctly synchronized.');
// Remove an item from the source items and check that its removed from all
// the translations.
$sync_langcode = $this->langcodes[1];
$unchanged_items = $this->unchangedFieldValues[$sync_langcode];
$field_values = $this->unchangedFieldValues;
$sync_delta = mt_rand(0, count($field_values[$sync_langcode]) - 1);
unset($field_values[$sync_langcode][$sync_delta]);
// Renumber deltas to start from 0.
$field_values[$sync_langcode] = array_values($field_values[$sync_langcode]);
$this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
$result = TRUE;
foreach ($this->unchangedFieldValues as $langcode => $items) {
$new_delta = 0;
// Check that the old values are still in place.
for ($delta = 0; $delta < $this->cardinality; $delta++) {
// Skip the removed item.
if ($delta != $sync_delta) {
foreach ($this->columns as $column) {
$result = $result && ($this->unchangedFieldValues[$langcode][$delta][$column] == $field_values[$langcode][$new_delta][$column]);
}
$new_delta++;
}
}
}
$this->assertTrue($result, 'A removed item has been correctly synchronized.');
// Move the items around in the source items and check that they are moved
// in all the translations.
$sync_langcode = $this->langcodes[3];
$unchanged_items = $this->unchangedFieldValues[$sync_langcode];
$field_values = $this->unchangedFieldValues;
$field_values[$sync_langcode] = array();
// Scramble the items.
foreach ($unchanged_items as $delta => $item) {
$new_delta = ($delta + 1) % $this->cardinality;
$field_values[$sync_langcode][$new_delta] = $item;
}
// Renumber deltas to start from 0.
ksort($field_values[$sync_langcode]);
$this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
$result = TRUE;
foreach ($field_values as $langcode => $items) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
$value = $field_values[$langcode][$delta][$column];
if (in_array($column, $this->synchronized)) {
// If we are dealing with a synchronize column the current value is
// supposed to be the same of the source items.
$result = $result && $field_values[$sync_langcode][$delta][$column] == $value;
}
else {
// Otherwise the values should be unchanged.
$old_delta = ($delta > 0 ? $delta : $this->cardinality) - 1;
$result = $result && $this->unchangedFieldValues[$langcode][$old_delta][$column] == $value;
}
}
}
}
$this->assertTrue($result, 'Scrambled items have been correctly synchronized.');
}
/**
* Tests that items holding the same values are correctly synchronized.
*/
public function testMultipleSyncedValues() {
$sync_langcode = $this->langcodes[1];
$unchanged_items = $this->unchangedFieldValues[$sync_langcode];
// Determine whether the unchanged values should be altered depending on
// their delta.
$delta_callbacks = array(
// Continuous field values: all values are equal.
function($delta) { return TRUE; },
// Alternated field values: only the even ones are equal.
function($delta) { return $delta % 2 !== 0; },
// Sparse field values: only the "middle" ones are equal.
function($delta) { return $delta === 1 || $delta === 2; },
// Sparse field values: only the "extreme" ones are equal.
function($delta) { return $delta === 0 || $delta === 3; },
);
foreach ($delta_callbacks as $delta_callback) {
$field_values = $this->unchangedFieldValues;
for ($delta = 0; $delta < $this->cardinality; $delta++) {
if ($delta_callback($delta)) {
foreach ($this->columns as $column) {
if (in_array($column, $this->synchronized)) {
$field_values[$sync_langcode][$delta][$column] = $field_values[$sync_langcode][0][$column];
}
}
}
}
$changed_items = $field_values[$sync_langcode];
$this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
foreach ($this->unchangedFieldValues as $langcode => $unchanged_items) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
// The first item is always unchanged hence it is retained by the
// synchronization process. The other ones are retained or synced
// depending on the logic implemented by the delta callback and
// whether it is a sync column or not.
$value = $delta > 0 && $delta_callback($delta) && in_array($column, $this->synchronized) ? $changed_items[0][$column] : $unchanged_items[$delta][$column];
$this->assertEqual($field_values[$langcode][$delta][$column], $value, "Item $delta column $column for langcode $langcode synced correctly");
}
}
}
}
}
/**
* Tests that one change in a synchronized column triggers a change in all columns.
*/
public function testDifferingSyncedColumns() {
$sync_langcode = $this->langcodes[2];
$unchanged_items = $this->unchangedFieldValues[$sync_langcode];
$field_values = $this->unchangedFieldValues;
for ($delta = 0; $delta < $this->cardinality; $delta++) {
$index = ($delta % 2) + 1;
$field_values[$sync_langcode][$delta]['sync' . $index] .= '-updated';
}
$changed_items = $field_values[$sync_langcode];
$this->synchronizer->synchronizeItems($field_values, $unchanged_items, $sync_langcode, $this->langcodes, $this->synchronized);
foreach ($this->unchangedFieldValues as $langcode => $unchanged_items) {
for ($delta = 0; $delta < $this->cardinality; $delta++) {
foreach ($this->columns as $column) {
// If the column is synchronized, the value should have been synced,
// for unsychronized columns, the value must not change.
$expected_value = in_array($column, $this->synchronized) ? $changed_items[$delta][$column] : $this->unchangedFieldValues[$langcode][$delta][$column];
$this->assertEqual($field_values[$langcode][$delta][$column], $expected_value, "Differing Item $delta column $column for langcode $langcode synced correctly");
}
}
}
}
}

View file

@ -1,15 +1,12 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationTestBase.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\field\Entity\FieldConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\simpletest\WebTestBase;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Base class for content translation tests.
@ -183,18 +180,18 @@ abstract class ContentTranslationTestBase extends WebTestBase {
if (empty($this->fieldName)) {
$this->fieldName = 'field_test_et_ui_test';
}
entity_create('field_storage_config', array(
FieldStorageConfig::create(array(
'field_name' => $this->fieldName,
'type' => 'string',
'entity_type' => $this->entityTypeId,
'cardinality' => 1,
))->save();
entity_create('field_config', array(
FieldConfig::create([
'entity_type' => $this->entityTypeId,
'field_name' => $this->fieldName,
'bundle' => $this->bundle,
'label' => 'Test translatable text-field',
))->save();
])->save();
entity_get_form_display($this->entityTypeId, $this->bundle, 'default')
->setComponent($this->fieldName, array(
'type' => 'string_textfield',
@ -232,7 +229,9 @@ abstract class ContentTranslationTestBase extends WebTestBase {
}
}
}
$entity = entity_create($this->entityTypeId, $entity_values);
$entity = $this->container->get('entity_type.manager')
->getStorage($this->entityTypeId)
->create($entity_values);
$entity->save();
return $entity->id();
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationUISkipTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\simpletest\WebTestBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationUITestBase.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Core\Cache\Cache;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\ContentTranslationWorkflowsTest.
*/
namespace Drupal\content_translation\Tests;
use Drupal\Component\Utility\SafeMarkup;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\Views\ContentTranslationViewsUITest.
*/
namespace Drupal\content_translation\Tests\Views;
use Drupal\views_ui\Tests\UITestBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\content_translation\Tests\Views\TranslationLinkTest.
*/
namespace Drupal\content_translation\Tests\Views;
use Drupal\content_translation\Tests\ContentTranslationTestBase;