createContent example

abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {

  use CreateTestContentEntitiesTrait;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Create content.     $this->createContent();

  }

  /** * Executes an upgrade and then an incremental upgrade. */
  public function doUpgradeAndIncremental() {
    // Start the upgrade process.     $this->submitCredentialForm();
    $session = $this->assertSession();

    


  /** * Tests all migrations with ID conflicts. */
  public function testAllMigrationsWithIdConflicts() {
    $migrations = $this->container
      ->get('plugin.manager.migration')
      ->createInstancesByTag('Drupal 7');

    // Create content.     $this->createContent();

    // Audit the IDs of all Drupal 7 migrations. There should be conflicts since     // content has been created.     $conflicts = array_map(
      function DAuditResult $result) {
        return $result->passed() ? NULL : $result->getMigration()->getBaseId();
      },
      (new IdAuditor())->auditMultiple($migrations)
    );

    $expected = [
      
$this->translatedLabel = $this->randomMachineName();

    $this->setUpLanguages();

    // We setup languages, so we need to ensure that the language manager     // and language path processor is updated.     $this->rebuildContainer();

    $this->setUpContentTypes();
    $this->enableTranslation();
    $this->setUpEntityReferenceField();
    $this->createContent();

    $this->webUser = $this->drupalCreateUser([
      'edit any ' . $this->referrerType->id() . ' content',
    ]);
  }

  /** * Tests if the entity is displayed in an entity reference field. */
  public function testEntityReferenceDisplay() {
    // Create a translated referrer entity.
/** * Tests all migrations with ID conflicts. */
  public function testAllMigrationsWithIdConflicts() {
    // Get all Drupal 6 migrations.     $migrations = $this->container
      ->get('plugin.manager.migration')
      ->createInstancesByTag('Drupal 6');

    // Create content.     $this->createContent();

    // Audit the IDs of all migrations. There should be conflicts since content     // has been created.     $conflicts = array_map(
      function DAuditResult $result) {
        return $result->passed() ? NULL : $result->getMigration()->getBaseId();
      },
      (new IdAuditor())->auditMultiple($migrations)
    );

    $expected = [
      
$this->getContainer()->get(Connection::class),
            $this->getContainer()->get(DefinitionInstanceRegistry::class)
        );

        $listener->removeUsedMedia($event);

        static::assertSame($mediaIds$event->getUnusedIds());
    }

    public function testMediaIdsFromAllPossibleLocationsAreRemovedFromEvent(): void
    {
        $mediaIds = $this->createContent();
        $event = new UnusedMediaSearchEvent($mediaIds);
        $listener = new CustomFieldsUnusedMediaSubscriber(
            $this->getContainer()->get(Connection::class),
            $this->getContainer()->get(DefinitionInstanceRegistry::class)
        );
        $listener->removeUsedMedia($event);

        static::assertEmpty($event->getUnusedIds());
    }

    public function testUnusedMediaIsPresent(): void
    {

  protected $nodeStorage;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setUpMigratedFiles();

    $this->createContent();

    $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage->delete($this->nodeStorage->loadMultiple());

    $this->installSchema('file', ['file_usage']);
    $this->executeMigrations([
      'language',
      'd6_language_content_settings',
      'd6_node_complete',
    ]);
  }
// Remove the classic node table made in setup.     $this->removeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '7');

    $this->fileMigrationSetup();

    $this->installEntitySchema('comment');
    $this->installEntitySchema('taxonomy_term');
    $this->installSchema('comment', ['comment_entity_statistics']);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('system', ['sequences']);

    $this->createContent();

    $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage->delete($this->nodeStorage->loadMultiple());

    $this->migrateUsers();
    $this->migrateFields();
    $this->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_comment_field',
      
$event = new UnusedMediaSearchEvent($mediaIds);
        $listener = new UnusedMediaSubscriber($this->getContainer()->get(Connection::class));

        $listener->removeUsedMedia($event);

        static::assertSame($mediaIds$event->getUnusedIds());
    }

    public function testMediaIdsFromAllPossibleLocationsAreRemovedFromEvent(): void
    {
        $mediaIds = $this->createContent();
        $event = new UnusedMediaSearchEvent($mediaIds);
        $listener = new UnusedMediaSubscriber($this->getContainer()->get(Connection::class));

        $listener->removeUsedMedia($event);

        static::assertEmpty($event->getUnusedIds());
    }

    /** * @return array<string> */
    
Home | Imprint | This part of the site doesn't use cookies.