You are here

public function MediaMigrationDatabaseTraitTest::testGetFilePlainBaseQuery in Media Migration 8

@covers ::getFilePlainBaseQuery

@dataProvider providerTest

File

tests/src/Kernel/Plugin/migrate/source/d7/MediaMigrationDatabaseTraitTest.php, line 36

Class

MediaMigrationDatabaseTraitTest
@coversDefaultClass \Drupal\media_migration\Plugin\migrate\source\d7\MediaMigrationDatabaseTrait

Namespace

Drupal\Tests\media_migration\Kernel\Plugin\migrate\source\d7

Code

public function testGetFilePlainBaseQuery(array $db_records, array $expected_results) {
  $class = new TestMediaMigrationDatabaseTrait();

  // Add records to the source database.
  $this
    ->addRecordsToSourceDatabase($db_records);
  $query = $class
    ->getFilePlainBaseQuery($this->sourceDatabase, FALSE);
  $query
    ->fields('fm', [
    'fid',
    'filename',
  ])
    ->orderBy('fm.fid');
  $results = $query
    ->execute()
    ->fetchAll(\PDO::FETCH_ASSOC);
  $this
    ->assertEquals($expected_results['Plain file'], $results);
}