function MigrationConfigurationTraitTest::testGetLegacyDrupalVersion
Same name in other branches
- 10 core/modules/migrate_drupal/tests/src/Unit/MigrationConfigurationTraitTest.php \Drupal\Tests\migrate_drupal\Unit\MigrationConfigurationTraitTest::testGetLegacyDrupalVersion()
- 11.x core/modules/migrate_drupal/tests/src/Unit/MigrationConfigurationTraitTest.php \Drupal\Tests\migrate_drupal\Unit\MigrationConfigurationTraitTest::testGetLegacyDrupalVersion()
@covers ::getLegacyDrupalVersion @dataProvider providerTestGetLegacyDrupalVersion
File
-
core/
modules/ migrate_drupal/ tests/ src/ Unit/ MigrationConfigurationTraitTest.php, line 19
Class
- MigrationConfigurationTraitTest
- @coversDefaultClass \Drupal\migrate_drupal\MigrationConfigurationTrait @group migrate_drupal
Namespace
Drupal\Tests\migrate_drupal\UnitCode
public function testGetLegacyDrupalVersion($expected_version_string, $schema_version, $exception, $table_map) {
if ($schema_version) {
$statement = $this->createMock('\\Drupal\\Core\\Database\\StatementInterface');
$statement->expects($this->any())
->method('fetchField')
->willReturn($schema_version);
}
$schema = $this->createMock('\\Drupal\\Core\\Database\\Schema');
$schema->expects($this->any())
->method('tableExists')
->willReturnMap($table_map);
$connection = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')
->disableOriginalConstructor()
->getMock();
if ($exception) {
$connection->expects($this->any())
->method('query')
->willThrowException($exception);
}
else {
$connection->expects($this->any())
->method('query')
->willReturn($statement);
}
$connection->expects($this->any())
->method('schema')
->willReturn($schema);
$actual_version_string = TestMigrationConfigurationTrait::getLegacyDrupalVersion($connection);
$this->assertSame($expected_version_string, $actual_version_string);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.