processedCount example

/** * {@inheritdoc} */
  public function allRowsProcessed() {
    $source_count = $this->getSourcePlugin()->count();
    // If the source is uncountable, we have no way of knowing if it's     // complete, so stipulate that it is.     if ($source_count < 0) {
      return TRUE;
    }
    $processed_count = $this->getIdMap()->processedCount();
    // We don't use == because in some circumstances (like unresolved stubs     // being created), the processed count may be higher than the available     // source rows.     return $source_count <= $processed_count;
  }

  /** * {@inheritdoc} */
  public function set($property_name$value) {
    if ($property_name == 'source') {
      
$this->assertSame('entity_reference', $field_storage->getType());
    $this->assertSame('node', $field_storage->getSetting('target_type'));

    // User reference to entity reference migration.     $field_storage = FieldStorageConfig::load('node.field_user_reference');
    $this->assertSame('entity_reference', $field_storage->getType());
    $this->assertSame('user', $field_storage->getSetting('target_type'));

    // Validate that the source count and processed count match up.     /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
    $migration = $this->getMigration('d6_field');
    $this->assertSame($migration->getSourcePlugin()->count()$migration->getIdMap()->processedCount());

    // Check that we've reported on a conflict in widget_types.     $messages = iterator_to_array($migration->getIdMap()->getMessages());
    $this->assertCount(1, $messages);
    $this->assertSame($messages[0]->message, 'Widget types optionwidgets_onoff, text_textfield are used in Drupal 6 field instances: widget type optionwidgets_onoff applied to the Drupal 8 base field');
  }

}
/** * Tests the number of processed source rows. * * Scenarios to test for: * - No processed rows. * - One processed row. * - Multiple processed rows. */
  public function testProcessedCount() {
    $id_map = $this->getIdMap();
    // Assert zero rows have been processed before adding rows.     $this->assertSame(0, $id_map->processedCount());
    $row_statuses = [
      MigrateIdMapInterface::STATUS_IMPORTED,
      MigrateIdMapInterface::STATUS_NEEDS_UPDATE,
      MigrateIdMapInterface::STATUS_IGNORED,
      MigrateIdMapInterface::STATUS_FAILED,
    ];
    // Create a mapping row for each STATUS constant.     foreach ($row_statuses as $status) {
      $source = ['source_id_property' => 'source_value_' . $status];
      $row = new Row($source['source_id_property' => []]);
      $destination = ['destination_id_property' => 'destination_value_' . $status];
      
Home | Imprint | This part of the site doesn't use cookies.