getDestinationIds example

    $this->migration = $this->prophesize(MigrationInterface::class);

    $this->migration->id()->willReturn(
      $this->randomMachineName(16)
    );
    // Prophesize a useless ID map plugin and an empty set of destination IDs.     // Calling code can override these prophecies later and set up different     // behaviors.     $this->migration->getIdMap()->willReturn(
      $this->prophesize(MigrateIdMapInterface::class)->reveal()
    );
    $this->migration->getDestinationIds()->willReturn([]);
  }

  /** * Determines the plugin to be tested by reading the class @covers annotation. * * @return string */
  protected function getPluginClass() {
    $annotations = Test::parseTestMethodAnnotations(
      static::class,
      $this->getName()
    );
$conditions->isNull($alias . '.sourceid1');
        $conditions->condition($alias . '.source_row_status', MigrateIdMapInterface::STATUS_NEEDS_UPDATE);
        $condition_added = TRUE;

        // And as long as we have the map table, add its data to the row.         $n = count($this->getIds());
        for ($count = 1; $count <= $n$count++) {
          $map_key = 'sourceid' . $count;
          $this->query->addField($alias$map_key, "migrate_map_$map_key");
          $added_fields[] = "$alias.$map_key";
        }
        if ($n = count($this->migration->getDestinationIds())) {
          for ($count = 1; $count <= $n$count++) {
            $map_key = 'destid' . $count++;
            $this->query->addField($alias$map_key, "migrate_map_$map_key");
            $added_fields[] = "$alias.$map_key";
          }
        }
        $this->query->addField($alias, 'source_row_status', 'migrate_map_source_row_status');
        $added_fields[] = "$alias.source_row_status";
      }
      // 2. If we are using high water marks, also include rows above the mark.       // But, include all rows if the high water mark is not set.
$migration = $plugin_manager->createStubMigration($plugin_definition);
    $this->assertSame(['required' => [], 'optional' => ['m1', 'm2', 'm3', 'm4', 'm5']]$migration->getMigrationDependencies(TRUE));
  }

  /** * Tests Migration::getDestinationIds() * * @covers ::getDestinationIds */
  public function testGetDestinationIds() {
    $migration = \Drupal::service('plugin.manager.migration')->createStubMigration(['destinationIds' => ['foo' => 'bar']]);
    $destination_ids = $migration->getDestinationIds();
    $this->assertNotEmpty($destination_ids, 'Destination ids are not empty');
    $this->assertEquals(['foo' => 'bar']$destination_ids, 'Destination ids match the expected values.');
  }

  /** * Tests Migration::getTrackLastImported() * * @covers ::getTrackLastImported * @covers ::isTrackLastImported * * @group legacy */
    $this->migration = $this->prophesize(MigrationInterface::class);

    $this->migration->id()->willReturn(
      $this->randomMachineName(16)
    );
    // Prophesize a useless ID map plugin and an empty set of destination IDs.     // Calling code can override these prophecies later and set up different     // behaviors.     $this->migration->getIdMap()->willReturn(
      $this->prophesize(MigrateIdMapInterface::class)->reveal()
    );
    $this->migration->getDestinationIds()->willReturn([]);
  }

  /** * Tests a negative batch size throws an exception. */
  public function testBatchSizeNegative() {
    $this->expectException(MigrateException::class);
    $this->expectExceptionMessage('batch_size must be greater than or equal to zero');
    $plugin = $this->getPlugin(['batch_size' => -1]);
    $plugin->next();
  }

  
Home | Imprint | This part of the site doesn't use cookies.