public function TranslationTest::testImportNonDefaultLanguage in Feeds 8.3
Tests importing only in a language that is not the default language.
File
- tests/
src/ Kernel/ Feeds/ Target/ TranslationTest.php, line 151
Class
- TranslationTest
- Test for the entity field translation.
Namespace
Drupal\Tests\feeds\Kernel\Feeds\TargetCode
public function testImportNonDefaultLanguage() {
// Set language to Spanish.
$configuration = $this->feedType
->getProcessor()
->getConfiguration();
$configuration['langcode'] = 'es';
$this->feedType
->getProcessor()
->setConfiguration($configuration);
// Set mappings for Spanish.
$this->feedType
->setMappings($this
->getMappingsInLanguage('es'));
$this->feedType
->save();
// Import Spanish content.
$this
->importContent($this
->resourcesPath() . '/csv/translation/content_es.csv');
$this
->assertNodeCount(1);
// Assert that Spanish values were created.
$node = Node::load(1);
$this
->assertEquals('es', $node
->language()
->getId());
$this
->assertEquals('HOLA MUNDO', $node->title->value);
$this
->assertEquals('Este es el texto del cuerpo.', $node->field_alpha->value);
}