You are here

class NodeTypeTest in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/node/src/Tests/NodeTypeTest.php \Drupal\node\Tests\NodeTypeTest
  2. 8 core/modules/node/tests/src/Unit/Plugin/migrate/source/d6/NodeTypeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeTypeTest
  3. 8 core/modules/node/tests/src/Unit/Plugin/migrate/source/d7/NodeTypeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d7\NodeTypeTest
Same name and namespace in other branches
  1. 8.0 core/modules/node/tests/src/Unit/Plugin/migrate/source/d6/NodeTypeTest.php \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeTypeTest

Tests D6 node type source plugin.

@group node

Hierarchy

Expanded class hierarchy of NodeTypeTest

File

core/modules/node/tests/src/Unit/Plugin/migrate/source/d6/NodeTypeTest.php, line 17
Contains \Drupal\Tests\node\Unit\Plugin\migrate\source\d6\NodeTypeTest.

Namespace

Drupal\Tests\node\Unit\Plugin\migrate\source\d6
View source
class NodeTypeTest extends MigrateSqlSourceTestCase {

  // The plugin system is not working during unit testing so the source plugin
  // class needs to be manually specified.
  const PLUGIN_CLASS = 'Drupal\\node\\Plugin\\migrate\\source\\d6\\NodeType';

  // The fake Migration configuration entity.
  protected $migrationConfiguration = array(
    // The ID of the entity, can be any string.
    'id' => 'test_nodetypes',
    'source' => array(
      'plugin' => 'd6_nodetype',
    ),
  );

  // We need to set up the database contents; it's easier to do that below.
  // These are sample result queries.
  protected $expectedResults = array(
    array(
      'type' => 'page',
      'name' => 'Page',
      'module' => 'node',
      'description' => 'A <em>page</em>, similar in form to a <em>story</em>, is a simple method for creating and displaying information that rarely changes, such as an "About us" section of a website. By default, a <em>page</em> entry does not allow visitor comments and is not featured on the site\'s initial home page.',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'page',
    ),
    array(
      'type' => 'story',
      'name' => 'Story',
      'module' => 'node',
      'description' => 'A <em>story</em>, similar in form to a <em>page</em>, is ideal for creating and displaying content that informs or engages website visitors. Press releases, site announcements, and informal blog-like entries may all be created with a <em>story</em> entry. By default, a <em>story</em> entry is automatically featured on the site\'s initial home page, and provides the ability to post comments.',
      'help' => '',
      'title_label' => 'Title',
      'has_body' => 1,
      'body_label' => 'Body',
      'min_word_count' => 0,
      'custom' => 1,
      'modified' => 0,
      'locked' => 0,
      'orig_type' => 'story',
    ),
  );

  /**
   * Prepopulate contents with results.
   */
  protected function setUp() {
    $this->databaseContents['node_type'] = $this->expectedResults;
    parent::setUp();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateSqlSourceTestCase::$databaseContents protected property The database contents. 5
MigrateSqlSourceTestCase::$expectedCount protected property Expected count of source rows.
MigrateSqlSourceTestCase::$plugin protected property The source plugin instance under test.
MigrateSqlSourceTestCase::$source protected property The tested source plugin.
MigrateSqlSourceTestCase::getValue protected function Overrides MigrateTestCase::getValue
MigrateSqlSourceTestCase::ORIGINAL_HIGH_WATER constant The high water mark at the beginning of the import operation. 1
MigrateSqlSourceTestCase::testRetrieval public function Test the source returns the same rows as expected.
MigrateSqlSourceTestCase::testSourceCount public function Test the source returns the row count expected.
MigrateSqlSourceTestCase::testSourceId public function Test the source defines a valid ID.
MigrateTestCase::$idMap protected property
MigrateTestCase::$migrationStatus protected property Local store for mocking setStatus()/getStatus().
MigrateTestCase::createSchemaFromRow protected function Generates a table schema from a row.
MigrateTestCase::getDatabase protected function Get an SQLite database connection object for use in tests.
MigrateTestCase::getMigration protected function Retrieve a mocked migration.
MigrateTestCase::queryResultTest public function Tests a query
MigrateTestCase::retrievalAssertHelper protected function Asserts tested values during test retrieval.
NodeTypeTest::$expectedResults protected property Expected results after the source parsing. Overrides MigrateSqlSourceTestCase::$expectedResults
NodeTypeTest::$migrationConfiguration protected property Overrides MigrateTestCase::$migrationConfiguration
NodeTypeTest::PLUGIN_CLASS constant The plugin class under test. Overrides MigrateSqlSourceTestCase::PLUGIN_CLASS
NodeTypeTest::setUp protected function Prepopulate contents with results. Overrides MigrateSqlSourceTestCase::setUp
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root.
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName protected function Mocks a block with a block plugin.
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed in array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.