class NodeRevisionTest in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Unit/Plugin/migrate/source/d6/NodeRevisionTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeRevisionTest
Tests D6 node revision source plugin.
@group node
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase
- class \Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase
- class \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeRevisionTest
- class \Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase
- class \Drupal\Tests\migrate\Unit\MigrateTestCase
Expanded class hierarchy of NodeRevisionTest
File
- core/
modules/ node/ tests/ src/ Unit/ Plugin/ migrate/ source/ d6/ NodeRevisionTest.php, line 17 - Contains \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeRevisionTest.
Namespace
Drupal\Tests\node\Unit\Plugin\migrate\source\d6View source
class NodeRevisionTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\\node\\Plugin\\migrate\\source\\d6\\NodeRevision';
// The fake Migration configuration entity.
protected $migrationConfiguration = [
'id' => 'test',
// The fake configuration for the source.
'source' => [
'plugin' => 'd6_node_revision',
],
'sourceIds' => [
'vid' => [
'alias' => 'v',
],
],
'destinationIds' => [
'vid' => [],
],
];
protected $databaseContents = [
'node' => [
[
'nid' => 1,
'type' => 'page',
'language' => 'en',
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
'vid' => 4,
'uid' => 1,
'title' => 'title for revision 1 (node 1)',
],
[
'nid' => 2,
'type' => 'article',
'language' => 'en',
'status' => 1,
'created' => 1279290908,
'changed' => 1279308993,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
'vid' => 2,
'uid' => 1,
'title' => 'title for revision 2 (node 2)',
],
],
'node_revisions' => [
[
'nid' => 1,
'vid' => 1,
'uid' => 1,
'title' => 'title for revision 1 (node 1)',
'body' => 'body for revision 1 (node 1)',
'teaser' => 'teaser for revision 1 (node 1)',
'log' => 'log for revision 1 (node 1)',
'format' => 1,
'timestamp' => 1279051598,
],
[
'nid' => 1,
'vid' => 3,
'uid' => 1,
'title' => 'title for revision 3 (node 1)',
'body' => 'body for revision 3 (node 1)',
'teaser' => 'teaser for revision 3 (node 1)',
'log' => 'log for revision 3 (node 1)',
'format' => 1,
'timestamp' => 1279051598,
],
[
'nid' => 1,
'vid' => 4,
'uid' => 1,
'title' => 'title for revision 4 (node 1)',
'body' => 'body for revision 4 (node 1)',
'teaser' => 'teaser for revision 4 (node 1)',
'log' => 'log for revision 4 (node 1)',
'format' => 1,
'timestamp' => 1279051598,
],
[
'nid' => 2,
'vid' => 2,
'uid' => 1,
'title' => 'title for revision 2 (node 2)',
'body' => 'body for revision 2 (node 2)',
'teaser' => 'teaser for revision 2 (node 2)',
'log' => 'log for revision 2 (node 2)',
'format' => 1,
'timestamp' => 1279308993,
],
],
];
// There are three revisions of nid 1, but the NodeRevision source ignores
// the current revision. So only two revisions will be returned here. nid 2
// is ignored because it only has one revision (the current one).
protected $expectedResults = [
[
// Node fields.
'nid' => 1,
'type' => 'page',
'language' => 'en',
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
// Node revision fields.
'vid' => 1,
'node_uid' => 1,
'revision_uid' => 1,
'title' => 'title for revision 1 (node 1)',
'body' => 'body for revision 1 (node 1)',
'teaser' => 'teaser for revision 1 (node 1)',
'log' => 'log for revision 1 (node 1)',
'format' => 1,
],
[
// Node fields.
'nid' => 1,
'type' => 'page',
'language' => 'en',
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
// Node revision fields.
'vid' => 3,
'node_uid' => 1,
'revision_uid' => 1,
'title' => 'title for revision 3 (node 1)',
'body' => 'body for revision 3 (node 1)',
'teaser' => 'teaser for revision 3 (node 1)',
'log' => 'log for revision 3 (node 1)',
'format' => 1,
],
];
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateSqlSourceTestCase:: |
protected | property | Expected count of source rows. | |
MigrateSqlSourceTestCase:: |
protected | property | The source plugin instance under test. | |
MigrateSqlSourceTestCase:: |
protected | property | The tested source plugin. | |
MigrateSqlSourceTestCase:: |
protected | function |
Overrides MigrateTestCase:: |
|
MigrateSqlSourceTestCase:: |
constant | The high water mark at the beginning of the import operation. | 1 | |
MigrateSqlSourceTestCase:: |
protected | function |
Overrides UnitTestCase:: |
61 |
MigrateSqlSourceTestCase:: |
public | function | Test the source returns the same rows as expected. | |
MigrateSqlSourceTestCase:: |
public | function | Test the source returns the row count expected. | |
MigrateSqlSourceTestCase:: |
public | function | Test the source defines a valid ID. | |
MigrateTestCase:: |
protected | property | ||
MigrateTestCase:: |
protected | property | Local store for mocking setStatus()/getStatus(). | |
MigrateTestCase:: |
protected | function | Generates a table schema from a row. | |
MigrateTestCase:: |
protected | function | Get an SQLite database connection object for use in tests. | |
MigrateTestCase:: |
protected | function | Retrieve a mocked migration. | |
MigrateTestCase:: |
public | function | Tests a query | |
MigrateTestCase:: |
protected | function | Asserts tested values during test retrieval. | |
NodeRevisionTest:: |
protected | property |
The database contents. Overrides MigrateSqlSourceTestCase:: |
|
NodeRevisionTest:: |
protected | property |
Expected results after the source parsing. Overrides MigrateSqlSourceTestCase:: |
|
NodeRevisionTest:: |
protected | property |
Overrides MigrateTestCase:: |
|
NodeRevisionTest:: |
constant |
The plugin class under test. Overrides MigrateSqlSourceTestCase:: |
||
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |