function ContentEntityTest::testFileSource

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityTest::testFileSource()
  2. 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityTest::testFileSource()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php \Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\ContentEntityTest::testFileSource()

Tests file source plugin.

@dataProvider migrationConfigurationProvider

File

core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php, line 298

Class

ContentEntityTest
Tests the entity content source plugin.

Namespace

Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source

Code

public function testFileSource(array $configuration) {
    $file = File::create([
        'filename' => 'foo.txt',
        'uid' => $this->user
            ->id(),
        'uri' => 'public://foo.txt',
    ]);
    $file->save();
    $migration = $this->migrationPluginManager
        ->createStubMigration($this->migrationDefinition('content_entity:file', $configuration));
    $file_source = $migration->getSourcePlugin();
    $this->assertSame('files', $file_source->__toString());
    if (!$configuration['include_translations']) {
        $this->assertEquals(1, $file_source->count());
    }
    $this->assertIds($