class MigrateNodeCompleteTest in Drupal 9
Same name in this branch
- 9 core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d6\MigrateNodeCompleteTest
- 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeCompleteTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest
Test class for a complete node migration for Drupal 7.
@group migrate_drupal_7
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, AssertLegacyTrait, ConfigTestTrait, ExtensionListTestTrait, PhpUnitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements MigrateMessageInterface
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses NodeMigrateTypeTestTrait
- class \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeCompleteTest uses FileMigrationSetupTrait, CreateTestContentEntitiesTrait, NodeMigrateTypeTestTrait
- class \Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase uses NodeMigrateTypeTestTrait
- class \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase implements MigrateMessageInterface
Expanded class hierarchy of MigrateNodeCompleteTest
File
- core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d7/ MigrateNodeCompleteTest.php, line 18
Namespace
Drupal\Tests\node\Kernel\Migrate\d7View source
class MigrateNodeCompleteTest extends MigrateDrupal7TestBase {
use FileMigrationSetupTrait;
use CreateTestContentEntitiesTrait;
use NodeMigrateTypeTestTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'content_translation',
'comment',
'datetime',
'image',
'language',
'link',
'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual',
'node',
'taxonomy',
'telephone',
'text',
];
/**
* The entity storage for node.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $nodeStorage;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
// Remove the classic node table made in setup.
$this
->removeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '7');
$this
->fileMigrationSetup();
$this
->installEntitySchema('comment');
$this
->installEntitySchema('taxonomy_term');
$this
->installSchema('comment', [
'comment_entity_statistics',
]);
$this
->installSchema('node', [
'node_access',
]);
$this
->installSchema('system', [
'sequences',
]);
$this
->createContent();
$this->nodeStorage = $this->container
->get('entity_type.manager')
->getStorage('node');
$this->nodeStorage
->delete($this->nodeStorage
->loadMultiple());
$this
->migrateUsers();
$this
->migrateFields();
$this
->executeMigrations([
'language',
'd7_language_content_settings',
'd7_comment_field',
'd7_comment_field_instance',
'd7_node_complete',
]);
$this->nodeStorage = $this->container
->get('entity_type.manager')
->getStorage('node');
}
/**
* {@inheritdoc}
*/
protected function getFileMigrationInfo() {
return [
'path' => 'public://sites/default/files/cube.jpeg',
'size' => '3620',
'base_path' => 'public://',
'plugin_id' => 'd7_file',
];
}
/**
* Tests the complete node migration.
*/
public function testNodeCompleteMigration() {
// Confirm there are only complete node migration map tables. This shows
// that only the complete migration ran.
$results = $this
->nodeMigrateMapTableCount('7');
$this
->assertSame(0, $results['node']);
$this
->assertSame(8, $results['node_complete']);
$db = \Drupal::database();
$this
->assertEquals($this
->expectedNodeFieldRevisionTable(), $db
->select('node_field_revision', 'nr')
->fields('nr')
->orderBy('vid')
->orderBy('langcode')
->execute()
->fetchAll(\PDO::FETCH_ASSOC));
$this
->assertEquals($this
->expectedNodeFieldDataTable(), $db
->select('node_field_data', 'nr')
->fields('nr')
->orderBy('nid')
->orderBy('vid')
->orderBy('langcode')
->execute()
->fetchAll(\PDO::FETCH_ASSOC));
// Load and test each revision.
$data = $this
->expectedRevisionEntityData()[0];
foreach ($this
->expectedNodeFieldRevisionTable() as $key => $revision) {
$this
->assertRevision($revision, $data[$key]);
}
// Test the migration of node and user reference fields.
foreach ([
2,
3,
] as $revision_id) {
$revision = $this->nodeStorage
->loadRevision($revision_id);
$this
->assertCount(1, $revision->field_node_reference);
$this
->assertSame('5', $revision->field_node_reference->target_id);
$this
->assertCount(1, $revision->field_user_reference);
$this
->assertSame('Bob', $revision->field_user_reference[0]->entity
->getAccountName());
}
// Test the order in multi-value fields.
$revision = $this->nodeStorage
->loadRevision(1);
$this
->assertSame([
[
'value' => 'default@example.com',
],
[
'value' => 'another@example.com',
],
], $revision
->get('field_email')
->getValue());
$this
->assertSame([
[
'target_id' => '17',
],
[
'target_id' => '15',
],
], $revision
->get('field_term_entityreference')
->getValue());
}
/**
* Tests rollback of the complete node migration.
*/
public function testRollbackNodeComplete() {
$db = \Drupal::database();
$node_types = [
'article',
'blog',
'book',
'forum',
'page',
'test_content_type',
];
foreach ($node_types as $node_type) {
// Execute the rollback.
$this->migration = $this
->getMigration("d7_node_complete:{$node_type}");
(new MigrateExecutable($this->migration, $this))
->rollback();
// Assert there are no nodes of node_type.
$count = $db
->select('node_field_data')
->condition('type', $node_type)
->countQuery()
->execute()
->fetchField();
$this
->assertSame($count, '0', "There are {$count} nodes of type {$node_type}");
}
}
/**
* Asserts various aspects of a node revision.
*
* @param array $revision
* An array of revision data matching a node_field_revision table row.
* @param array $data
* An array of revision data.
*/
protected function assertRevision(array $revision, array $data) {
/** @var \Drupal\node\NodeInterface $actual */
$actual = $this->nodeStorage
->loadRevision($revision['vid'])
->getTranslation($revision['langcode']);
$this
->assertInstanceOf(NodeInterface::class, $actual);
$this
->assertSame($revision['title'], $actual
->getTitle(), sprintf("Title '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['title'], $actual
->getTitle(), $revision['vid'], $revision['langcode']));
$this
->assertSame($revision['revision_translation_affected'], $actual
->get('revision_translation_affected')->value, sprintf("revision_translation_affected '%s' does not match actual '%s' for revision '%d' langcode '%s'", $revision['revision_translation_affected'], $actual
->get('revision_translation_affected')->value, $revision['vid'], $revision['langcode']));
$this
->assertSame($data['revision_created'], $actual
->getRevisionCreationTime(), sprintf("Creation time '%s' does not match actual '%s' for revision '%d' langcode '%s'", $data['revision_created'], $actual
->getRevisionCreationTime(), $revision['vid'], $revision['langcode']));
$this
->assertSame($data['log'], $actual
->getRevisionLogMessage(), sprintf("Revision log '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['log'], TRUE), $actual
->getRevisionLogMessage(), $revision['vid'], $revision['langcode']));
if (isset($data['field_text_long_plain'])) {
$this
->assertSame($data['field_text_long_plain'], $actual->field_text_long_plain->value, sprintf("field_text_long_plain value '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['field_text_long_plain'], TRUE), $actual->field_text_long_plain->value, $revision['vid'], $revision['langcode']));
}
if (isset($data['field_tree'])) {
$this
->assertSame($data['field_tree'], $actual->field_tree->value, sprintf("field_tree value '%s' does not match actual '%s' for revision '%d' langcode '%s'", var_export($data['field_tree'], TRUE), $actual->field_tree->value, $revision['vid'], $revision['langcode']));
}
}
/**
* Provides the expected node_field_data table.
*
* @return array
* The expected table rows.
*/
protected function expectedNodeFieldDataTable() {
return [
0 => [
'nid' => '1',
'vid' => '1',
'type' => 'test_content_type',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'An English Node',
'created' => '1529615790',
'changed' => '1529615790',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
1 => [
'nid' => '2',
'vid' => '12',
'type' => 'article',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'The thing about Deep Space 9',
'created' => '1441306772',
'changed' => '1564543637',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
2 => [
'nid' => '2',
'vid' => '12',
'type' => 'article',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Deep Space 9',
'created' => '1471428152',
'changed' => '1564543706',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
3 => [
'nid' => '4',
'vid' => '14',
'type' => 'article',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'en - The thing about Firefly',
'created' => '1478755314',
'changed' => '1564543929',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
4 => [
'nid' => '4',
'vid' => '14',
'type' => 'article',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Firefly',
'created' => '1478755274',
'changed' => '1564543810',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
5 => [
'nid' => '6',
'vid' => '6',
'type' => 'forum',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Comments are closed :-(',
'created' => '1504715414',
'changed' => '1504715414',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
6 => [
'nid' => '7',
'vid' => '7',
'type' => 'forum',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Comments are open :-)',
'created' => '1504715432',
'changed' => '1504715432',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
7 => [
'nid' => '8',
'vid' => '10',
'type' => 'blog',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'The number 47',
'created' => '1551000341',
'changed' => '1552126247',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
8 => [
'nid' => '8',
'vid' => '10',
'type' => 'blog',
'langcode' => 'fr',
'status' => '1',
'uid' => '1',
'title' => 'fr - The number 47',
'created' => '1552126296',
'changed' => '1552126296',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
9 => [
'nid' => '8',
'vid' => '10',
'type' => 'blog',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The number 47',
'created' => '1552126363',
'changed' => '1552126363',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
10 => [
'nid' => '11',
'vid' => '18',
'type' => 'et',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261523',
'changed' => '1568261687',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => '',
'content_translation_outdated' => '0',
],
11 => [
'nid' => '11',
'vid' => '18',
'type' => 'et',
'langcode' => 'fr',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261721',
'changed' => '1568261721',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
12 => [
'nid' => '11',
'vid' => '18',
'type' => 'et',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261548',
'changed' => '1568261548',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
];
}
/**
* Provides the expected node_field_revision table.
*
* @return array
* The table.
*/
protected function expectedNodeFieldRevisionTable() {
return [
0 => [
'nid' => '1',
'vid' => '1',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'An English Node',
'created' => '1529615790',
'changed' => '1529615790',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
1 => [
'nid' => '2',
'vid' => '2',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'The thing about Deep Space 9 (1st rev)',
'created' => '1441306772',
'changed' => '1564543588',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
2 => [
'nid' => '2',
'vid' => '3',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'The thing about Deep Space 9 (1st rev)',
'created' => '1441306772',
'changed' => '1564543588',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
3 => [
'nid' => '2',
'vid' => '3',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Deep Space 9 (1st rev)',
'created' => '1471428152',
'changed' => '1564543677',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
4 => [
'nid' => '4',
'vid' => '4',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Firefly (1st rev)',
'created' => '1478755274',
'changed' => '1478755274',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
5 => [
'nid' => '4',
'vid' => '5',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'en - The thing about Firefly (1st rev)',
'created' => '1478755314',
'changed' => '1564543887',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
6 => [
'nid' => '4',
'vid' => '5',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Firefly (1st rev)',
'created' => '1478755274',
'changed' => '1478755274',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
7 => [
'nid' => '6',
'vid' => '6',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Comments are closed :-(',
'created' => '1504715414',
'changed' => '1504715414',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
8 => [
'nid' => '7',
'vid' => '7',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Comments are open :-)',
'created' => '1504715432',
'changed' => '1504715432',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
9 => [
'nid' => '8',
'vid' => '8',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'The number 47',
'created' => '1551000341',
'changed' => '1552126247',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
10 => [
'nid' => '8',
'vid' => '9',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'The number 47',
'created' => '1551000341',
'changed' => '1552126247',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
11 => [
'nid' => '8',
'vid' => '9',
'langcode' => 'fr',
'status' => '1',
'uid' => '1',
'title' => 'fr - The number 47',
'created' => '1552126296',
'changed' => '1552126296',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
12 => [
'nid' => '8',
'vid' => '10',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'The number 47',
'created' => '1551000341',
'changed' => '1552126247',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
13 => [
'nid' => '8',
'vid' => '10',
'langcode' => 'fr',
'status' => '1',
'uid' => '1',
'title' => 'fr - The number 47',
'created' => '1552126296',
'changed' => '1552126296',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
14 => [
'nid' => '8',
'vid' => '10',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The number 47',
'created' => '1552126363',
'changed' => '1552126363',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
15 => [
'nid' => '2',
'vid' => '11',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'The thing about Deep Space 9',
'created' => '1441306772',
'changed' => '1564543637',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
16 => [
'nid' => '2',
'vid' => '11',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Deep Space 9 (1st rev)',
'created' => '1471428152',
'changed' => '1564543637',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
17 => [
'nid' => '2',
'vid' => '12',
'langcode' => 'en',
'status' => '1',
'uid' => '2',
'title' => 'The thing about Deep Space 9',
'created' => '1441306772',
'changed' => '1564543637',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
18 => [
'nid' => '2',
'vid' => '12',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Deep Space 9',
'created' => '1471428152',
'changed' => '1564543706',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
19 => [
'nid' => '4',
'vid' => '13',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'en - The thing about Firefly (1st rev)',
'created' => '1478755314',
'changed' => '1564543887',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
20 => [
'nid' => '4',
'vid' => '13',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Firefly',
'created' => '1478755274',
'changed' => '1564543810',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
21 => [
'nid' => '4',
'vid' => '14',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'en - The thing about Firefly',
'created' => '1478755314',
'changed' => '1564543929',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
22 => [
'nid' => '4',
'vid' => '14',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'is - The thing about Firefly',
'created' => '1478755274',
'changed' => '1564543810',
'promote' => '1',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => 'is',
'content_translation_outdated' => '0',
],
23 => [
'nid' => '11',
'vid' => '15',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261523',
'changed' => '1568261523',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => '1',
'content_translation_source' => NULL,
'content_translation_outdated' => '0',
],
24 => [
'nid' => '11',
'vid' => '16',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261523',
'changed' => '1568261523',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => '',
'content_translation_outdated' => '0',
],
25 => [
'nid' => '11',
'vid' => '16',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261548',
'changed' => '1568261548',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
26 => [
'nid' => '11',
'vid' => '17',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261523',
'changed' => '1568261687',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => '',
'content_translation_outdated' => '0',
],
27 => [
'nid' => '11',
'vid' => '17',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261548',
'changed' => '1568261548',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
28 => [
'nid' => '11',
'vid' => '18',
'langcode' => 'en',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261523',
'changed' => '1568261687',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '1',
'revision_translation_affected' => NULL,
'content_translation_source' => '',
'content_translation_outdated' => '0',
],
29 => [
'nid' => '11',
'vid' => '18',
'langcode' => 'fr',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261721',
'changed' => '1568261721',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => '1',
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
30 => [
'nid' => '11',
'vid' => '18',
'langcode' => 'is',
'status' => '1',
'uid' => '1',
'title' => 'Page one',
'created' => '1568261548',
'changed' => '1568261548',
'promote' => '0',
'sticky' => '0',
'default_langcode' => '0',
'revision_translation_affected' => NULL,
'content_translation_source' => 'en',
'content_translation_outdated' => '0',
],
];
}
/**
* Provides the expected node_field_revision table.
*
* @return array
* Selected properties and fields on the revision.
*/
protected function expectedRevisionEntityData() {
return [
$revision_data = [
// Node 1, revision 1, en.
0 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1529615790',
],
// Node 2, revision 2, en.
1 => [
'log' => 'DS9 1st rev',
'field_text_long_plain' => 'DS9 1st rev',
'revision_created' => '1564543588',
],
// Node 2, revision 3, en.
2 => [
'log' => 'is - DS9 1st rev',
'field_text_long_plain' => 'DS9 1st rev',
'revision_created' => '1564543677',
],
// Node 2, revision 3, is.
3 => [
'log' => 'is - DS9 1st rev',
'field_text_long_plain' => 'is - DS9 1st rev',
'revision_created' => '1564543677',
],
// Node 4, revision 4, is.
4 => [
'log' => 'is - Firefly 1st rev',
'field_text_long_plain' => NULL,
'revision_created' => '1478755274',
],
// Node 4, revision 5, en.
5 => [
'log' => 'Firefly 1st rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543887',
],
// Node 4, revision 5, is.
6 => [
'log' => 'Firefly 1st rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543887',
],
// Node 6, revision 6, en.
7 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1504715414',
],
// Node 7, revision 7, en.
8 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1504715432',
],
// Node 8, revision 8, en.
9 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126247',
],
// Node 8, revision 9, en.
10 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126296',
],
// Node 8, revision 9, fr.
11 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126296',
],
// Node 8, revision 10, en.
12 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126363',
],
// Node 8, revision 10, fr.
13 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126363',
],
// Node 8, revision 10, is.
14 => [
'log' => NULL,
'field_text_long_plain' => NULL,
'revision_created' => '1552126363',
],
// Node 2, revision 11, en.
15 => [
'log' => 'DS9 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543637',
],
// Node 2, revision 11, is.
16 => [
'log' => 'DS9 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543637',
],
// Node 2, revision 12, en.
17 => [
'log' => 'is - DS9 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543706',
],
// Node 2, revision 12, is.
18 => [
'log' => 'is - DS9 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543706',
],
// Node 4, revision 13, en.
19 => [
'log' => 'is - Firefly 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543810',
],
// Node 4, revision 13, is.
20 => [
'log' => 'is - Firefly 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543810',
],
// Node 4, revision 14, en.
21 => [
'log' => 'Firefly 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543929',
],
// Node 4, revision 14, is.
22 => [
'log' => 'Firefly 2nd rev',
'field_text_long_plain' => NULL,
'revision_created' => '1564543929',
],
// Node 11, revision 15, en.
23 => [
'log' => NULL,
'body' => '1st',
'field_tree' => 'lancewood',
'revision_created' => '1568261523',
],
// Node 11, revision 16, en.
24 => [
'log' => NULL,
'body' => '1st',
'field_tree' => 'lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 16, is.
25 => [
'log' => NULL,
'body' => '1st',
'field_tree' => 'is - lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 17, en.
26 => [
'log' => '2nd',
'body' => '2nd',
'field_tree' => 'lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 17, is.
27 => [
'log' => '2nd',
'body' => '2nd',
'field_tree' => 'is - lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 18, en.
28 => [
'log' => NULL,
'body' => '2nd',
'field_tree' => 'lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 18, f5.
29 => [
'log' => NULL,
'body' => '2nd',
'field_tree' => 'fr - lancewood',
'revision_created' => '1568261548',
],
// Node 11, revision 18, is.
30 => [
'log' => NULL,
'body' => '2nd',
'field_tree' => 'is - lancewood',
'revision_created' => '1568261548',
],
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertContentTrait:: |
protected | property | The current raw content. | |
AssertContentTrait:: |
protected | property | The drupalSettings value from the current raw $content. | |
AssertContentTrait:: |
protected | property | The XML structure parsed from the current raw $content. | 1 |
AssertContentTrait:: |
protected | property | The plain-text content of raw $content (text nodes). | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertContentTrait:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href is not found in the main region. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page does not exist. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the perl regex pattern is not found in raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text is NOT found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | |
AssertContentTrait:: |
protected | function | Pass if the page title is not the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | |
AssertContentTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertContentTrait:: |
protected | function | Asserts that a Perl regex pattern is found in the plain-text content. | |
AssertContentTrait:: |
protected | function | Asserts themed output. | |
AssertContentTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
AssertContentTrait:: |
protected | function | Builds an XPath query. | |
AssertContentTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertContentTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
AssertContentTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertContentTrait:: |
protected | function | Gets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Gets the current raw content. | |
AssertContentTrait:: |
protected | function | Get the selected value from a select field. | |
AssertContentTrait:: |
protected | function | Retrieves the plain-text content from the current raw content. | |
AssertContentTrait:: |
protected | function | Get the current URL from the cURL handler. | 1 |
AssertContentTrait:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
AssertContentTrait:: |
protected | function | Removes all white-space between HTML tags from the raw content. | |
AssertContentTrait:: |
protected | function | Sets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Sets the raw content (e.g. HTML). | |
AssertContentTrait:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
CreateTestContentEntitiesTrait:: |
protected | function | Create several pieces of generic content. | |
CreateTestContentEntitiesTrait:: |
protected | function | Create several pieces of generic content. | |
CreateTestContentEntitiesTrait:: |
protected | function | Gets required modules. | |
CreateTestContentEntitiesTrait:: |
protected | function | Install required entity schemas. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified module. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified theme. | |
FileMigrationSetupTrait:: |
protected | function | Tests a single file entity. | 1 |
FileMigrationSetupTrait:: |
protected | function | Prepare the file migration for running. | |
KernelTestBase:: |
protected | property | Back up and restore any global variables that may be changed by tests. | |
KernelTestBase:: |
protected | property | Back up and restore static class properties that may be changed by tests. | |
KernelTestBase:: |
protected | property | Contains a few static class properties for performance. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | @todo Move into Config test base class. | 7 |
KernelTestBase:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Do not forward any global state from the parent process to the processes that run the actual tests. | |
KernelTestBase:: |
protected | property | The app root. | |
KernelTestBase:: |
protected | property | Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Set to TRUE to strict check all configuration saved. | 6 |
KernelTestBase:: |
protected | property | The virtual filesystem root directory. | |
KernelTestBase:: |
protected | function | 1 | |
KernelTestBase:: |
protected | function | Bootstraps a basic test environment. | |
KernelTestBase:: |
private | function | Bootstraps a kernel for a test. | |
KernelTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
KernelTestBase:: |
protected | function | Disables modules for this test. | |
KernelTestBase:: |
protected | function | Enables modules for this test. | |
KernelTestBase:: |
protected | function | Gets the config schema exclusions for this test. | |
KernelTestBase:: |
protected | function | Returns the Database connection info to be used for this test. | 3 |
KernelTestBase:: |
public | function | ||
KernelTestBase:: |
private | function | Returns Extension objects for $modules to enable. | |
KernelTestBase:: |
private static | function | Returns the modules to enable for this test. | |
KernelTestBase:: |
protected | function | Initializes the FileCache component. | |
KernelTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
KernelTestBase:: |
protected | function | Installs the storage schema for a specific entity type. | |
KernelTestBase:: |
protected | function | Installs database tables from a module schema definition. | |
KernelTestBase:: |
protected | function | ||
KernelTestBase:: |
public | function |
Registers test-specific services. Overrides ServiceProviderInterface:: |
24 |
KernelTestBase:: |
protected | function | Renders a render array. | 1 |
KernelTestBase:: |
protected | function | Sets the install profile and rebuilds the container to update it. | |
KernelTestBase:: |
protected | function | Sets an in-memory Settings variable. | |
KernelTestBase:: |
public static | function | 1 | |
KernelTestBase:: |
protected | function | Sets up the filesystem, so things like the file directory. | 2 |
KernelTestBase:: |
protected | function | Stops test execution. | |
KernelTestBase:: |
public | function | @after | |
KernelTestBase:: |
protected | function | Dumps the current state of the virtual filesystem to STDOUT. | |
KernelTestBase:: |
public | function | Prevents serializing any properties. | |
MigrateDrupal7TestBase:: |
protected | function | Gets the path to the fixture file. | |
MigrateDrupal7TestBase:: |
protected | function | Migrates comment types. | |
MigrateDrupal7TestBase:: |
protected | function | Executes all content migrations. | |
MigrateDrupal7TestBase:: |
protected | function | Migrates node types. | |
MigrateDrupal7TestBase:: |
protected | function | Executes all field migrations. | |
MigrateDrupal7TestBase:: |
protected | function | Executes all taxonomy term migrations. | |
MigrateDrupal7TestBase:: |
protected | function | Executes all user migrations. | |
MigrateDrupalTestBase:: |
protected | function | Loads a database fixture into the source database connection. | |
MigrateNodeCompleteTest:: |
protected static | property |
Modules to enable. Overrides MigrateDrupalTestBase:: |
|
MigrateNodeCompleteTest:: |
protected | property | The entity storage for node. | |
MigrateNodeCompleteTest:: |
protected | function | Asserts various aspects of a node revision. | |
MigrateNodeCompleteTest:: |
protected | function | Provides the expected node_field_data table. | |
MigrateNodeCompleteTest:: |
protected | function | Provides the expected node_field_revision table. | |
MigrateNodeCompleteTest:: |
protected | function | Provides the expected node_field_revision table. | |
MigrateNodeCompleteTest:: |
protected | function |
Returns information about the file to be migrated. Overrides FileMigrationSetupTrait:: |
|
MigrateNodeCompleteTest:: |
protected | function |
Overrides MigrateDrupal7TestBase:: |
|
MigrateNodeCompleteTest:: |
public | function | Tests the complete node migration. | |
MigrateNodeCompleteTest:: |
public | function | Tests rollback of the complete node migration. | |
MigrateTestBase:: |
protected | property | TRUE to collect messages instead of displaying them. | |
MigrateTestBase:: |
protected | property | A logger prophecy object. | 2 |
MigrateTestBase:: |
protected | property | A two dimensional array of messages. | |
MigrateTestBase:: |
protected | property | The primary migration being tested. | 1 |
MigrateTestBase:: |
protected | property | The source database connection. | |
MigrateTestBase:: |
private | function | Cleans up the test migrate connection. | |
MigrateTestBase:: |
private | function | Changes the database connection to the prefixed one. | |
MigrateTestBase:: |
public | function |
Displays a migrate message. Overrides MigrateMessageInterface:: |
|
MigrateTestBase:: |
protected | function | Executes a single migration. | |
MigrateTestBase:: |
protected | function | Executes a set of migrations in dependency order. | |
MigrateTestBase:: |
protected | function | Gets the migration plugin. | |
MigrateTestBase:: |
protected | function | Records a failure in the map table of a specific migration. | |
MigrateTestBase:: |
protected | function | Modify a migration's configuration before executing it. | |
MigrateTestBase:: |
protected | function | Prepare any dependent migrations. | |
MigrateTestBase:: |
protected | function | Injects the test logger into the container. | |
MigrateTestBase:: |
public | function | Start collecting messages and erase previous messages. | |
MigrateTestBase:: |
public | function | Stop collecting messages. | |
MigrateTestBase:: |
protected | function |
Overrides KernelTestBase:: |
|
NodeMigrateTypeTestTrait:: |
public | property | The migrate_map table name. | |
NodeMigrateTypeTestTrait:: |
protected | function | Gets the migrate_map table name. | |
NodeMigrateTypeTestTrait:: |
protected | function | Create a node migrate_map table. | |
NodeMigrateTypeTestTrait:: |
protected | function | Gets the numbers of complete and classic node migrate_map tables. | |
NodeMigrateTypeTestTrait:: |
protected | function | Remove the node migrate map table. | |
PhpUnitWarnings:: |
private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | |
PhpUnitWarnings:: |
public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. |