setUpMigratedFiles example


  protected function setUp(): void {
    parent::setUp();

    // Remove the file_directory_path to test site_path setting.     // @see \Drupal\Tests\file\Kernel\Migrate\d6\FileMigrationTestTrait::prepareMigration()     Database::getConnection('default', 'migrate')
      ->delete('variable')
      ->condition('name', 'file_directory_path')
      ->execute();

    $this->setUpMigratedFiles();
  }

  /** * Asserts a file entity. * * @param int $fid * The file ID. * @param string $name * The expected file name. * @param int $size * The expected file size. * @param string $uri * The expected file URI. * @param string $type * The expected MIME type. * @param int $uid * The expected file owner ID. * * @internal */
/** * {@inheritdoc} */
  protected static $modules = ['menu_ui'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setUpMigratedFiles();
    $this->installSchema('file', ['file_usage']);
    $this->executeMigrations([
      'd6_node',
    ]);
  }

  /** * Tests image migration from Drupal 6 to 8. */
  public function testNode() {
    $node = Node::load(9);
    

  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',
      
protected static $modules = [
    'language',
    'content_translation',
    'menu_ui',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setUpMigratedFiles();
    $this->installSchema('file', ['file_usage']);
    $this->executeMigrations([
      'language',
      'd6_language_content_settings',
      'd6_node',
      'd6_node_translation',
    ]);
  }

  /** * Tests node migration from Drupal 6 to 8. */
$this->assertSame('2', $file->getOwnerId());
    $this->assertSame(1901, $file->getSize());
    $this->assertSame('image/jpeg', $file->getMimeType());

    $file = array_shift($files);
    $this->assertSame('image-test.png', $file->getFilename());
    $this->assertSame('public://image-test.png', $file->getFileUri());
    $this->assertSame('8', $file->getOwnerId());
    $this->assertEmpty($files);

    // Tests the D6 user pictures migration in combination with D6 file.     $this->setUpMigratedFiles();
    $this->assertEntity(1, 'image-test.jpg', 1901, 'public://image-test.jpg', 'image/jpeg', 2);
    $this->assertEntity(2, 'image-test.png', 125, 'public://image-test.png', 'image/png', 8);
    $this->assertEntity(3, 'Image1.png', 39325, 'public://image-1.png', 'image/png', 1);
    $this->assertEntity(4, 'Image2.jpg', 1831, 'public://image-2.jpg', 'image/jpeg', 1);
    $this->assertEntity(5, 'Image-test.gif', 183, 'public://image-test.gif', 'image/jpeg', 1);
    $this->assertEntity(6, 'html-1.txt', 19, 'public://html-1.txt', 'text/plain', 1);
  }

  /** * Asserts a file entity. * * @param int $fid * The file ID. * @param string $name * The expected file name. * @param int $size * The expected file size. * @param string $uri * The expected file URI. * @param string $type * The expected MIME type. * @param int $uid * The expected file owner ID. * * @internal */
Home | Imprint | This part of the site doesn't use cookies.