ContentTranslationUpdateTest.php in Drupal 8
File
core/modules/content_translation/tests/src/Functional/Update/ContentTranslationUpdateTest.php
View source
<?php
namespace Drupal\Tests\content_translation\Functional\Update;
use Drupal\Core\Language\LanguageInterface;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait;
class ContentTranslationUpdateTest extends UpdatePathTestBase {
use EntityDefinitionTestTrait;
protected $database;
protected $entityDefinitionUpdateManager;
protected $state;
protected function setUp() {
parent::setUp();
$this->database = \Drupal::database();
$this->entityDefinitionUpdateManager = \Drupal::entityDefinitionUpdateManager();
$this->state = \Drupal::state();
}
public function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.0.0-rc1-filled.standard.entity_test_update_mul.php.gz',
];
}
public function testContentTranslationUpdate8400() {
$this
->updateEntityTypeToTranslatable();
$first_entity_record = $this->database
->select('entity_test_update_data', 'etud')
->fields('etud')
->condition('etud.id', 1)
->execute()
->fetchAllAssoc('id');
$this
->assertNull($first_entity_record[1]->content_translation_source);
$this
->assertNull($first_entity_record[1]->content_translation_outdated);
$this
->assertNull($first_entity_record[1]->content_translation_status);
$this
->runUpdates();
$first_entity_record = $this->database
->select('entity_test_update_data', 'etud')
->fields('etud')
->condition('etud.id', 1)
->execute()
->fetchAllAssoc('id');
$this
->assertEqual(LanguageInterface::LANGCODE_NOT_SPECIFIED, $first_entity_record[1]->content_translation_source);
$this
->assertEqual(0, $first_entity_record[1]->content_translation_outdated);
$this
->assertEqual(1, $first_entity_record[1]->content_translation_status);
}
}