Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -140,9 +140,26 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends WebTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests if the translated entity is displayed in an entity reference field.
|
||||
* Tests if the entity is displayed in an entity reference field.
|
||||
*/
|
||||
public function testTranslatedEntityReferenceDisplay() {
|
||||
public function testEntityReferenceDisplay() {
|
||||
// Create a translated referrer entity.
|
||||
$this->referrerEntity = $this->createReferrerEntity();
|
||||
$this->assertEntityReferenceDisplay();
|
||||
|
||||
// Disable translation for referrer content type.
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$this->drupalPostForm('admin/config/regional/content-language', ['settings[node][referrer][translatable]' => FALSE], t('Save configuration'));
|
||||
|
||||
// Create a referrer entity without translation.
|
||||
$this->referrerEntity = $this->createReferrerEntity(FALSE);
|
||||
$this->assertEntityReferenceDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert entity reference display.
|
||||
*/
|
||||
protected function assertEntityReferenceDisplay() {
|
||||
$url = $this->referrerEntity->urlInfo();
|
||||
$translation_url = $this->referrerEntity->urlInfo('canonical', ['language' => ConfigurableLanguage::load($this->translateToLangcode)]);
|
||||
|
||||
|
@ -169,7 +186,6 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends WebTestBase {
|
|||
protected function createContent() {
|
||||
$this->referencedEntityWithTranslation = $this->createReferencedEntityWithTranslation();
|
||||
$this->referencedEntityWithoutTranslation = $this->createNotTranslatedReferencedEntity();
|
||||
$this->referrerEntity = $this->createReferrerEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -283,7 +299,7 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends WebTestBase {
|
|||
/**
|
||||
* Create the referrer entity.
|
||||
*/
|
||||
protected function createReferrerEntity() {
|
||||
protected function createReferrerEntity($translatable = TRUE) {
|
||||
/** @var \Drupal\node\Entity\Node $node */
|
||||
$node = entity_create($this->testEntityTypeName, array(
|
||||
'title' => $this->randomMachineName(),
|
||||
|
@ -298,8 +314,9 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends WebTestBase {
|
|||
),
|
||||
'langcode' => $this->baseLangcode,
|
||||
));
|
||||
$node->save();
|
||||
$node->addTranslation($this->translateToLangcode, $node->toArray());
|
||||
if ($translatable) {
|
||||
$node->addTranslation($this->translateToLangcode, $node->toArray());
|
||||
}
|
||||
$node->save();
|
||||
|
||||
return $node;
|
||||
|
|
|
@ -27,10 +27,11 @@ class MigrateFieldInstanceTest extends MigrateDrupal6TestBase {
|
|||
|
||||
$entity = Node::create(['type' => 'story']);
|
||||
// Test a text field.
|
||||
/** @var \Drupal\field\FieldConfigInterface $field */
|
||||
$field = FieldConfig::load('node.story.field_test');
|
||||
$this->assertIdentical('Text Field', $field->label());
|
||||
$expected = array('max_length' => 255);
|
||||
$this->assertIdentical($expected, $field->getSettings());
|
||||
// field_test is a text_long field, which have no settings.
|
||||
$this->assertIdentical([], $field->getSettings());
|
||||
$this->assertIdentical('text for default value', $entity->field_test->value);
|
||||
|
||||
// Test a number field.
|
||||
|
|
|
@ -33,9 +33,9 @@ class MigrateFieldTest extends MigrateDrupal6TestBase {
|
|||
// Text field.
|
||||
/** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */
|
||||
$field_storage = FieldStorageConfig::load('node.field_test');
|
||||
$expected = array('max_length' => 255);
|
||||
$this->assertIdentical("text", $field_storage->getType(), t('Field type is @fieldtype. It should be text.', array('@fieldtype' => $field_storage->getType())));
|
||||
$this->assertIdentical($expected, $field_storage->getSettings(), "Field type text settings are correct");
|
||||
$this->assertIdentical('text_long', $field_storage->getType());
|
||||
// text_long fields do not have settings.
|
||||
$this->assertIdentical([], $field_storage->getSettings());
|
||||
|
||||
// Integer field.
|
||||
$field_storage = FieldStorageConfig::load('node.field_test_two');
|
||||
|
|
Reference in a new issue