getSystemData example

$state = $this->createMock('Drupal\Core\State\StateInterface');
    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
    $entity_type_manager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface');
    $this->base = new TestDrupal6SqlBase($this->migrationConfiguration, $plugin[]$this->getMigration()$state$entity_type_manager);
    $this->base->setDatabase($this->getDatabase($this->databaseContents));
  }

  /** * Tests for Drupal6SqlBase::getSystemData(). */
  public function testGetSystemData() {
    $system_data = $this->base->getSystemData();
    // Should be 1 theme and 2 modules.     $this->assertCount(1, $system_data['theme']);
    $this->assertCount(2, $system_data['module']);

    // Calling again should be identical.     $this->assertSame($system_data$this->base->getSystemData());
  }

  /** * Tests for Drupal6SqlBase::moduleExists(). */
  

  protected function setupMigrations(Connection $connection$version, array $database, FormStateInterface $form_state) {
    $this->createDatabaseStateSettings($database$version);
    $migrations = $this->getMigrations('migrate_drupal_' . $version$version);

    // Get the system data from source database.     $system_data = $this->getSystemData($connection);

    // Convert the migration object into array     // so that it can be stored in form storage.     $migration_array = [];
    foreach ($migrations as $migration) {
      $migration_array[$migration->id()] = $migration->label();
    }

    // Store information in the private store.     $this->store->set('version', $version);
    $this->store->set('migrations', $migration_array);
    
/** * Retrieves a module schema_version from the source Drupal database. * * @param string $module * Name of module. * * @return mixed * The current module schema version on the origin system table or FALSE if * not found. */
  protected function getModuleSchemaVersion($module) {
    $system_data = $this->getSystemData();
    return $system_data['module'][$module]['schema_version'] ?? FALSE;
  }

  /** * Checks if a given module is enabled in the source Drupal database. * * @param string $module * Name of module to check. * * @return bool * TRUE if module is enabled on the origin system, FALSE if not. */
Home | Imprint | This part of the site doesn't use cookies.