TaxonomyTermParentMultilingualTest.php in Drupal 8
File
core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermParentMultilingualTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\taxonomy\Entity\Term;
use Drupal\user\Entity\User;
class TaxonomyTermParentMultilingualTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.taxonomy-parent-multilingual-3066439.php',
];
}
public function testMultilingualTermParentUpdate() {
$settings['entity_update_batch_size'] = (object) [
'value' => 30,
'required' => TRUE,
];
$this
->writeSettings($settings);
$this
->runUpdates();
$term = Term::load(65);
$this
->assertSame('64', $term->parent[0]->target_id);
$term = Term::load(2);
$this
->assertSame('0', $term->parent[0]->target_id);
$account = User::load(1);
$account->passRaw = 'drupal';
$this
->drupalLogin($account);
$this
->drupalGet('admin/structure/taxonomy/manage/test_vocabulary/overview');
$assert_session = $this
->assertSession();
$assert_session
->pageTextContains('Test root term');
$assert_session
->pageTextContains('Test child term');
$this
->drupalGet('taxonomy/term/2/translations');
$assert_session
->linkExists('Test root term - Spanish');
$storage = \Drupal::entityTypeManager()
->getStorage('taxonomy_term');
$term = $storage
->load(2);
$translation = $term
->getTranslation('es');
$this
->assertTrue($translation
->isPublished());
}
protected function replaceUser1() {
}
}