Drupal 8  8.0.2
MigrateSqlIdMapTest Class Reference
Inheritance diagram for MigrateSqlIdMapTest:

Public Member Functions

 testSaveIdMapping ()
 
 testSetMessage ()
 
 testClearMessages ()
 
 testGetRowsNeedingUpdate ()
 
 testMessageCount ()
 
 testMessageSave ()
 
 testGetRowBySource ()
 
 lookupDestinationIdMappingDataProvider ()
 
 testLookupDestinationIdMapping ($num_source_fields, $num_destination_fields)
 
 testGetRowByDestination ()
 
 lookupSourceIDMappingDataProvider ()
 
 testLookupSourceIDMapping ($num_source_fields, $num_destination_fields)
 
 testImportedCount ()
 
 testProcessedCount ()
 
 updateCountDataProvider ()
 
 testUpdateCount ($num_update_rows)
 
 errorCountDataProvider ()
 
 testErrorCount ($num_error_rows)
 
 testSetUpdate ()
 
 testPrepareUpdate ()
 
 testDestroy ()
 
 testGetQualifiedMapTablePrefix ()
 
 testIterators ()
 
- Public Member Functions inherited from MigrateTestCase
 queryResultTest ($iter, $expected_results)
 
- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Protected Member Functions

 setUp ()
 
 saveMap (array $map)
 
 getIdMap ()
 
 idMapDefaults ()
 
- Protected Member Functions inherited from MigrateTestCase
 getMigration ()
 
 getDatabase (array $database_contents, $connection_options=[])
 
 createSchemaFromRow (array $row)
 
 getValue ($row, $key)
 
 retrievalAssertHelper ($expected_value, $actual_value, $message)
 
- Protected Member Functions inherited from UnitTestCase
 setUp ()
 
 getRandomGenerator ()
 
 assertArrayEquals (array $expected, array $actual, $message=NULL)
 
 getBlockMockWithMachineName ($machine_name)
 
 getContainerWithCacheTagsInvalidator (CacheTagsInvalidatorInterface $cache_tags_validator)
 
 getClassResolverStub ()
 

Protected Attributes

 $migrationConfiguration
 
 $sourceIds
 
 $destinationIds
 
 $database
 
- Protected Attributes inherited from MigrateTestCase
 $migrationConfiguration = []
 
 $idMap
 
 $migrationStatus = MigrationInterface::STATUS_IDLE
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Detailed Description

Tests the SQL ID map plugin.

migrate

Member Function Documentation

errorCountDataProvider ( )

Data provider for testErrorCount().

Scenarios to test for:

  • No errors.
  • One error.
  • Multiple errors.
Returns
array An array of data values.
idMapDefaults ( )
protected

Sets defaults for SQL ID map plugin tests.

Returns
array An associative array with the following keys:
  • source_row_status
  • rollback_action
  • hash

References Drupal\database(), MigrateIdMapInterface\ROLLBACK_DELETE, and MigrateIdMapInterface\STATUS_IMPORTED.

Referenced by MigrateSqlIdMapTest\testErrorCount(), MigrateSqlIdMapTest\testGetRowByDestination(), MigrateSqlIdMapTest\testGetRowBySource(), MigrateSqlIdMapTest\testIterators(), MigrateSqlIdMapTest\testLookupDestinationIdMapping(), MigrateSqlIdMapTest\testLookupSourceIDMapping(), MigrateSqlIdMapTest\testSaveIdMapping(), and MigrateSqlIdMapTest\testUpdateCount().

Here is the call graph for this function:

Here is the caller graph for this function:

lookupDestinationIdMappingDataProvider ( )

Data provider for testLookupDestinationIdMapping().

Scenarios to test (for both hits and misses) are:

  • Single-value source ID to single-value destination ID.
  • Multi-value source ID to multi-value destination ID.
  • Single-value source ID to multi-value destination ID.
  • Multi-value source ID to single-value destination ID.
Returns
array An array of data values.
lookupSourceIDMappingDataProvider ( )

Data provider for testLookupSourceIDMapping().

Scenarios to test (for both hits and misses) are:

  • Single-value destination ID to single-value source ID.
  • Multi-value destination ID to multi-value source ID.
  • Single-value destination ID to multi-value source ID.
  • Multi-value destination ID to single-value source ID.
Returns
array An array of data values.
saveMap ( array  $map)
protected

Saves a single ID mapping row in the database.

Parameters
array$mapThe row to save.

References MigrateTestCase\createSchemaFromRow(), and Drupal\database().

Referenced by MigrateSqlIdMapTest\testErrorCount(), MigrateSqlIdMapTest\testGetRowByDestination(), MigrateSqlIdMapTest\testGetRowBySource(), MigrateSqlIdMapTest\testIterators(), MigrateSqlIdMapTest\testLookupDestinationIdMapping(), MigrateSqlIdMapTest\testLookupSourceIDMapping(), and MigrateSqlIdMapTest\testUpdateCount().

Here is the call graph for this function:

Here is the caller graph for this function:

setUp ( )
protected

{}

References Drupal\database(), and MigrateTestCase\getDatabase().

Here is the call graph for this function:

testClearMessages ( )

Tests the clear messages method.

References MigrateSqlIdMapTest\getIdMap().

Here is the call graph for this function:

testDestroy ( )

Tests the destroy method.

Scenarios to test for:

  • No errors.
  • One error.
  • Multiple errors.

References Drupal\database(), and MigrateSqlIdMapTest\getIdMap().

Here is the call graph for this function:

testErrorCount (   $num_error_rows)

Performs error count test with a given number of error rows.

Parameters
int$num_error_rowsNumber of error rows to test.

errorCountDataProvider

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), MigrateSqlIdMapTest\saveMap(), and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testGetQualifiedMapTablePrefix ( )

Tests the getQualifiedMapTable method with a prefixed database.

References Drupal\database(), MigrateSqlIdMapTest\getIdMap(), and Connection\open().

Here is the call graph for this function:

testGetRowByDestination ( )

Tests the getRowByDestination method.

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), and MigrateSqlIdMapTest\saveMap().

Here is the call graph for this function:

testGetRowBySource ( )

Tests the getRowBySource method.

References MigrateTestCase\getDatabase(), MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), and MigrateSqlIdMapTest\saveMap().

Here is the call graph for this function:

testGetRowsNeedingUpdate ( )

Tests the getRowsNeedingUpdate method for rows that need an update.

References MigrateSqlIdMapTest\getIdMap(), MigrateTestCase\queryResultTest(), MigrateIdMapInterface\ROLLBACK_DELETE, and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testImportedCount ( )

Tests the imported count method.

Scenarios to test for:

  • No imports.
  • One import.
  • Multiple imports.

References MigrateSqlIdMapTest\getIdMap(), and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testIterators ( )

Tests all the iterator methods in one swing.

The iterator methods are:

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), MigrateSqlIdMapTest\saveMap(), and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testLookupDestinationIdMapping (   $num_source_fields,
  $num_destination_fields 
)

Performs destination ID test on source and destination fields.

Parameters
int$num_source_fieldsNumber of source fields to test.
int$num_destination_fieldsNumber of destination fields to test.

lookupDestinationIdMappingDataProvider

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), and MigrateSqlIdMapTest\saveMap().

Here is the call graph for this function:

testLookupSourceIDMapping (   $num_source_fields,
  $num_destination_fields 
)

Performs the source ID test on source and destination fields.

Parameters
int$num_source_fieldsNumber of source fields to test.
int$num_destination_fieldsNumber of destination fields to test.

lookupSourceIDMappingDataProvider

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), and MigrateSqlIdMapTest\saveMap().

Here is the call graph for this function:

testMessageCount ( )

Tests the SQL ID map message count method by counting and saving messages.

References MigrateSqlIdMapTest\getIdMap().

Here is the call graph for this function:

testMessageSave ( )

Tests the SQL ID map save message method.

References MigrateSqlIdMapTest\getIdMap(), MigrationInterface\MESSAGE_ERROR, MigrationInterface\MESSAGE_INFORMATIONAL, MigrationInterface\MESSAGE_NOTICE, and MigrationInterface\MESSAGE_WARNING.

Here is the call graph for this function:

testPrepareUpdate ( )

Tests prepareUpdate().

References MigrateSqlIdMapTest\getIdMap(), MigrateTestCase\queryResultTest(), MigrateIdMapInterface\ROLLBACK_DELETE, and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testProcessedCount ( )

Tests the number of processed source rows.

Scenarios to test for:

  • No processed rows.
  • One processed row.
  • Multiple processed rows.

References MigrateSqlIdMapTest\getIdMap(), and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testSaveIdMapping ( )

Tests the ID mapping method.

Create two ID mappings and update the second to verify that:

  • saving new to empty tables work.
  • saving new to nonempty tables work.
  • updating work.

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), and MigrateTestCase\queryResultTest().

Here is the call graph for this function:

testSetMessage ( )

Tests the SQL ID map set message method.

References MigrateSqlIdMapTest\getIdMap().

Here is the call graph for this function:

testSetUpdate ( )

Tests setting a row source_row_status to STATUS_NEEDS_UPDATE.

References MigrateSqlIdMapTest\getIdMap(), MigrateTestCase\queryResultTest(), MigrateIdMapInterface\ROLLBACK_DELETE, and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

testUpdateCount (   $num_update_rows)

Performs the update count test with a given number of update rows.

Parameters
int$num_update_rowsThe number of update rows to test.

updateCountDataProvider

References MigrateSqlIdMapTest\getIdMap(), MigrateSqlIdMapTest\idMapDefaults(), MigrateSqlIdMapTest\saveMap(), and MigrateIdMapInterface\STATUS_IMPORTED.

Here is the call graph for this function:

updateCountDataProvider ( )

Data provider for testUpdateCount().

Scenarios to test for:

  • No updates.
  • One update.
  • Multiple updates.
Returns
array An array of data values.

Field Documentation

$destinationIds
protected
Initial value:
= [
'destination_id_property' => [
'type' => 'string'
$migrationConfiguration
protected
Initial value:
= [
'id' => 'sql_idmap_test'
$sourceIds
protected
Initial value:
= [
'source_id_property' => [
'type' => 'string'

The documentation for this class was generated from the following file: