public function LingotekConfigDependenciesTest::testExportingConfigDependencies in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 4.0.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.1.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.2.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.3.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.4.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.5.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.6.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.7.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
- 3.8.x tests/src/Functional/LingotekConfigDependenciesTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigDependenciesTest::testExportingConfigDependencies()
File
- tests/src/Functional/LingotekConfigDependenciesTest.php, line 22
Class
- LingotekConfigDependenciesTest
- Class LingotekConfigDependenciesTest
Namespace
Drupal\Tests\lingotek\Functional
Code
public function testExportingConfigDependencies() {
$assert_session = $this
->assertSession();
$config_translation_service = \Drupal::service('lingotek.config_translation');
$this
->drupalPlaceBlock('local_tasks_block', [
'region' => 'highlighted',
]);
$this
->drupalPlaceBlock('page_title_block', [
'region' => 'highlighted',
]);
$content_type = $this
->drupalCreateContentType([
'type' => 'article',
'label' => 'Article',
]);
ConfigurableLanguage::createFromLangcode('es')
->save();
$this
->drupalLogin($this->rootUser);
ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('node', 'article', TRUE);
$this
->drupalGet('admin/lingotek/settings');
$assert_session
->statusCodeEquals(200);
$this
->saveLingotekContentTranslationSettingsForNodeTypes([
'article',
], 'manual');
$this
->saveLingotekConfigTranslationSettings([
'node_type' => 'manual',
'node_fields' => 'automatic',
]);
$this
->goToConfigBulkManagementForm('node_type');
$this
->clickLink('EN');
$this
->assertText('article uploaded successfully');
$this
->assertEqual(Lingotek::STATUS_IMPORTING, $config_translation_service
->getSourceStatus($content_type));
$field = \Drupal::entityTypeManager()
->getStorage('field_config')
->load('node.article.body');
$this
->goToConfigBulkManagementForm('node_fields');
$this
->clickLink('EN');
$this
->assertText('Body uploaded successfully');
$this
->assertEqual(Lingotek::STATUS_IMPORTING, $config_translation_service
->getSourceStatus($field));
$this
->copyConfig($this->container
->get('config.storage'), $this->container
->get('config.storage.sync'));
$content_type
->delete();
$type = \Drupal::entityTypeManager()
->getStorage('node_type')
->load('article');
$this
->assertNull($type, 'Article doesn\'t exist anymore');
$field = \Drupal::entityTypeManager()
->getStorage('field_config')
->load('node.article.body');
$this
->assertNull($field, 'Article Body doesn\'t exist anymore');
$this
->configImporter()
->import();
$type = \Drupal::entityTypeManager()
->getStorage('node_type')
->load('article');
$this
->assertNotNull($type, 'Article is back');
$this
->assertEqual(Lingotek::STATUS_IMPORTING, $config_translation_service
->getSourceStatus($type));
$field = \Drupal::entityTypeManager()
->getStorage('field_config')
->load('node.article.body');
$this
->assertNotNull($field, 'Article Body is back');
$this
->assertEqual(Lingotek::STATUS_IMPORTING, $config_translation_service
->getSourceStatus($field));
}