Commit 5ce0364f authored by heddn's avatar heddn Committed by heddn
Browse files

Issue #3131401 by heddn: Return type void in tests

parent b992e26f
......@@ -25,5 +25,8 @@
"suggest": {
"sainsburys/guzzle-oauth2-plugin": "3.0 required for the OAuth2 authentication plugin",
"ext-soap": "*"
},
"requires": {
"php": ">=7.1"
}
}
......@@ -2,8 +2,7 @@ type: module
name: Migrate Example
description: 'Examples of how Drupal 8+ migration compares to previous versions.'
package: Examples
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- drupal:migrate
- migrate_plus:migrate_example_setup
......
......@@ -2,8 +2,7 @@ type: module
name: Migrate Example Setup
description: 'Separate site configuration for the example from the actual migration.'
package: Migration
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
hidden: true
dependencies:
- drupal:comment
......
......@@ -2,8 +2,7 @@ type: module
name: Migrate Example (Advanced)
description: 'Specialized examples of Drupal 8+ migration.'
package: Examples
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- drupal:migrate
- migrate_plus:migrate_example_advanced_setup
......
......@@ -2,8 +2,7 @@ type: module
name: Migrate Advanced Example Setup
description: 'Separate site configuration for the example from the actual migration.'
package: Migration
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
hidden: true
dependencies:
- drupal:comment
......
......@@ -2,8 +2,7 @@ type: module
name: Migrate JSON Example
description: 'Simple JSON Migration example'
package: Examples
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- drupal:migrate
- migrate_plus:migrate_plus
......@@ -2,7 +2,6 @@ type: module
name: Migrate Plus
description: 'Enhancements to core migration support'
package: Migration
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- drupal:migrate
......@@ -2,8 +2,7 @@ type: module
name: Migrate Plus Test
description: 'Test module to test Migrate Plus.'
package: Testing
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
dependencies:
- drupal:migrate
- migrate_plus:migrate_plus
......@@ -39,7 +39,7 @@ class LoadTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->user = $this->drupalCreateUser(['administer site configuration']);
$this->drupalLogin($this->user);
......@@ -48,7 +48,7 @@ class LoadTest extends BrowserTestBase {
/**
* Tests that the home page loads with a 200 response.
*/
public function testLoad() {
public function testLoad(): void {
$this->drupalGet(Url::fromRoute('<front>'));
$this->assertSession()->statusCodeEquals(200);
}
......
......@@ -50,7 +50,7 @@ class EntityLookupAccessTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('entity_test');
......@@ -64,7 +64,7 @@ class EntityLookupAccessTest extends KernelTestBase {
/**
* Tests that access is honored for entity lookups.
*/
public function testEntityLookupAccessCheck() {
public function testEntityLookupAccessCheck(): void {
$definition = [
'source' => [
'plugin' => 'embedded_data',
......
......@@ -29,7 +29,7 @@ class MigrateTableIncrementTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->connection = $this->container->get('database');
$this->connection->schema()->createTable(static::TABLE_NAME, [
......@@ -57,7 +57,7 @@ class MigrateTableIncrementTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected function tearDown() {
protected function tearDown(): void {
$this->connection->schema()->dropTable(static::TABLE_NAME);
parent::tearDown();
}
......@@ -68,7 +68,7 @@ class MigrateTableIncrementTest extends MigrateTestBase {
* @return array
* The migration definition.
*/
public function tableDestinationMigration() {
public function tableDestinationMigration(): array {
return [
'dummy table' => [
[
......
......@@ -39,7 +39,7 @@ class MigrateTableTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->connection = $this->container->get('database');
......@@ -98,7 +98,7 @@ class MigrateTableTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected function tearDown() {
protected function tearDown(): void {
$this->sourceDatabase->schema()->dropTable(static::SOURCE_TABLE_NAME);
$this->connection->schema()->dropTable(static::DEST_TABLE_NAME);
parent::tearDown();
......@@ -157,7 +157,7 @@ class MigrateTableTest extends MigrateTestBase {
/**
* Tests table migration.
*/
public function testTableMigration() {
public function testTableMigration(): void {
$definition = [
'id' => 'migration_table_test',
'migration_tags' => ['Testing'],
......@@ -214,7 +214,7 @@ class MigrateTableTest extends MigrateTestBase {
*
* @dataProvider tableDestinationMigration
*/
public function testTableUpdate(array $definition) {
public function testTableUpdate(array $definition): void {
// Make sure migration overwrites the original data for the first row.
$original_values = [
'data' => 'dummy value',
......
......@@ -37,7 +37,7 @@ class MigrationConfigEntityTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->pluginManager = \Drupal::service('plugin.manager.migration');
$this->installConfig('migrate_plus');
......@@ -48,7 +48,7 @@ class MigrationConfigEntityTest extends MigrateTestBase {
/**
* Tests cache invalidation.
*/
public function testCacheInvalidation() {
public function testCacheInvalidation(): void {
$config = Migration::create([
'id' => 'test',
'status' => TRUE,
......@@ -77,7 +77,7 @@ class MigrationConfigEntityTest extends MigrateTestBase {
/**
* Tests migration status.
*/
public function testMigrationStatus() {
public function testMigrationStatus(): void {
$configs = [
[
'id' => 'test_active',
......@@ -115,7 +115,7 @@ class MigrationConfigEntityTest extends MigrateTestBase {
/**
* Tests migration from configuration.
*/
public function testImport() {
public function testImport(): void {
$this->installConfig('migrate_plus_test');
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$migration = $this->pluginManager->createInstance('fruit_terms');
......
......@@ -21,7 +21,7 @@ class MigrationGroupTest extends KernelTestBase {
/**
* Test that group configuration is properly merged into specific migrations.
*/
public function testConfigurationMerge() {
public function testConfigurationMerge(): void {
$group_id = 'test_group';
/** @var \Drupal\migrate_plus\Entity\MigrationGroupInterface $migration_group */
......@@ -96,7 +96,7 @@ class MigrationGroupTest extends KernelTestBase {
/**
* Test that deleting a group deletes its migrations.
*/
public function testDelete() {
public function testDelete(): void {
/** @var \Drupal\migrate_plus\Entity\MigrationGroupInterface $migration_group */
$group_configuration = [
'id' => 'test_group',
......@@ -130,7 +130,7 @@ class MigrationGroupTest extends KernelTestBase {
/**
* Test that migrations without a group are assigned to the default group.
*/
public function testDefaultGroup() {
public function testDefaultGroup(): void {
$this->installConfig('migrate_plus_test');
/** @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface $pluginManager */
......
......@@ -32,7 +32,7 @@ class DefaultEntityValueTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
......@@ -43,7 +43,7 @@ class DefaultEntityValueTest extends KernelTestBase {
*
* @covers ::transform
*/
public function testDefaultEntityValue() {
public function testDefaultEntityValue(): void {
// Create a user.
$editorial_user = $this->createUser([], 'editorial');
$journalist_user = $this->createUser([], 'journalist');
......
......@@ -71,7 +71,7 @@ class EntityGenerateTest extends KernelTestBase implements MigrateMessageInterfa
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
// Create article content type.
$values = [
......@@ -132,7 +132,7 @@ class EntityGenerateTest extends KernelTestBase implements MigrateMessageInterfa
*
* @covers ::transform
*/
public function testTransform(array $definition, array $expected, array $preSeed = []) {
public function testTransform(array $definition, array $expected, array $preSeed = []): void {
// Pre seed some test data.
foreach ($preSeed as $storageName => $values) {
// If the first element of $values is a non-empty array, create multiple
......@@ -149,8 +149,11 @@ class EntityGenerateTest extends KernelTestBase implements MigrateMessageInterfa
/** @var \Drupal\migrate\Plugin\Migration $migration */
$migration = $this->migrationPluginManager->createStubMigration($definition);
$reflector = new \ReflectionObject($migration->getDestinationPlugin());
$attribute = $reflector->getProperty('storage');
$attribute->setAccessible(true);
/** @var \Drupal\Core\Entity\EntityStorageBase $storage */
$storage = $this->readAttribute($migration->getDestinationPlugin(), 'storage');
$storage = $attribute->getValue($migration->getDestinationPlugin());
$migrationExecutable = (new MigrateExecutable($migration, $this));
$migrationExecutable->import();
......
......@@ -32,7 +32,7 @@ class EntityLookupTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
......@@ -46,7 +46,7 @@ class EntityLookupTest extends KernelTestBase {
*
* @covers ::transform
*/
public function testLookupEntityWithoutBundles() {
public function testLookupEntityWithoutBundles(): void {
// Create a user.
$known_user = $this->createUser([], 'lucuma');
// Setup test migration objects.
......
......@@ -58,7 +58,7 @@ class FileBlobTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->pluginManager = $this->container->get('plugin.manager.migrate.process');
......@@ -200,7 +200,7 @@ EOT;
*
* @covers ::transform
*/
public function testFileCreation() {
public function testFileCreation(): void {
/** @var \Drupal\migrate\MigrateExecutableInterface $executable */
$executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
$row = new Row([], []);
......
......@@ -18,7 +18,7 @@ class HttpTest extends KernelTestBase {
*
* @dataProvider headerDataProvider
*/
public function testHttpHeaders(array $definition, array $expected, array $preSeed = []) {
public function testHttpHeaders(array $definition, array $expected, array $preSeed = []): void {
$http = new Http($definition, 'http', []);
$this->assertEquals($expected, $http->getRequestHeaders());
}
......@@ -29,7 +29,7 @@ class HttpTest extends KernelTestBase {
* @return array
* The test cases
*/
public function headerDataProvider() {
public function headerDataProvider(): array {
return [
'dummy headers specified' => [
'definition' => [
......
......@@ -33,7 +33,7 @@ class JsonTest extends KernelTestBase {
* @throws \Drupal\Component\Plugin\Exception\PluginException
* @throws \Exception
*/
public function testMissingProperties($file, array $ids, array $fields, array $expected) {
public function testMissingProperties($file, array $ids, array $fields, array $expected): void {
$path = $this->container
->get('module_handler')
->getModule('migrate_plus')
......@@ -69,7 +69,7 @@ class JsonTest extends KernelTestBase {
* @return array
* The test cases.
*/
public function jsonBaseDataProvider() {
public function jsonBaseDataProvider(): array {
return [
'missing properties' => [
'file' => 'missing_properties.json',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment