Commit f58fccc2 authored by catch's avatar catch
Browse files

Issue #3261004 by quietone, paulocs, andypost: Remove deprecated code from the migration system

parent da3c1027
Loading
Loading
Loading
Loading
+0 −4
Changes for core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -140,10 +140,6 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles);
    $this->entityFieldManager = $entity_field_manager;
    $this->fieldTypeManager = $field_type_manager;
    if ($account_switcher === NULL) {
      @trigger_error('Calling ' . __NAMESPACE__ . '\EntityContentBase::__construct() without the $account_switcher argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3142975', E_USER_DEPRECATED);
      $account_switcher = \Drupal::service('account_switcher');
    }
    $this->accountSwitcher = $account_switcher;
  }

+0 −20
Changes for core/modules/migrate/tests/src/Kernel/MigrateEntityContentBaseTest.php: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -304,24 +304,4 @@ public function testStubRows() {
    }
  }

  /**
   * Test BC injection of account switcher service.
   *
   * @group legacy
   */
  public function testAccountSwitcherBackwardsCompatibility() {
    $this->expectDeprecation('Calling Drupal\migrate\Plugin\migrate\destination\EntityContentBase::__construct() without the $account_switcher argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3142975');
    $destination = new EntityContentBase(
      [],
      'fake_plugin_id',
      [],
      $this->createMock(MigrationInterface::class),
      $this->storage,
      [],
      $this->container->get('entity_field.manager'),
      $this->container->get('plugin.manager.field.field_type')
    );
    $this->assertInstanceOf(EntityContentBase::class, $destination);
  }

}
+0 −24
Changes for core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php: 0 added lines, 24 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\migrate_drupal\Plugin\migrate\field;

use Drupal\migrate_drupal\Plugin\migrate\field\d6\NodeReference as NonLegacyNodeReference;

/**
 * @deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use
 * \Drupal\migrate_drupal\Plugin\migrate\field\d6\NodeReference instead.
 *
 * @see https://www.drupal.org/node/3159537
 */
class NodeReference extends NonLegacyNodeReference {

  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    @trigger_error('The ' . __NAMESPACE__ . '\NodeReference is deprecated in drupal:9.1.0 and will be removed from drupal:10.0.0. Instead use \Drupal\migrate_drupal\Plugin\migrate\field\d6\NodeReference. See https://www.drupal.org/node/3159537.', E_USER_DEPRECATED);

    parent::__construct($configuration, $plugin_id, $plugin_definition);
  }

}
+0 −64
Changes for core/modules/migrate_drupal/tests/src/Unit/Plugin/migrate/field/d6/NodeReferenceFieldTest.php: 0 added lines, 64 removed lines.
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\migrate_drupal\Unit\Plugin\migrate\field\d6;

use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\migrate_drupal\Plugin\migrate\field\NodeReference;
use Prophecy\Argument;

/**
 * Tests legacy NodeReference migrate field plugin.
 *
 * @coversDefaultClass \Drupal\migrate_drupal\Plugin\migrate\field\NodeReference
 * @group migrate_drupal
 * @group legacy
 */
class NodeReferenceFieldTest extends UnitTestCase {

  /**
   * The plugin being tested.
   *
   * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
   */
  protected $plugin;

  /**
   * The prophesize migration.
   *
   * @var \Drupal\migrate\Plugin\MigrationInterface|\Prophecy\Prophecy\ProphecyInterface
   */
  protected $migration;

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    $this->plugin = new NodeReference([], 'nodereference', []);

    $migration = $this->prophesize(MigrationInterface::class);

    $migration->setProcessOfProperty(Argument::type('string'), Argument::type('array'))
      ->will(function ($arguments) use ($migration) {
        $migration->getProcess()->willReturn($arguments[1]);
      });
    $this->migration = $migration->reveal();
  }

  /**
   * @covers ::defineValueProcessPipeline
   * @runInSeparateProcess
   */
  public function testDefineValueProcessPipeline() {
    $this->expectDeprecation('The Drupal\migrate_drupal\Plugin\migrate\field\NodeReference is deprecated in drupal:9.1.0 and will be removed from drupal:10.0.0. Instead use \Drupal\migrate_drupal\Plugin\migrate\field\d6\NodeReference. See https://www.drupal.org/node/3159537.');
    $this->plugin->defineValueProcessPipeline($this->migration, 'field_name', []);

    $expected = [
      'plugin' => 'sub_process',
      'source' => 'field_name',
      'process' => ['target_id' => 'nid'],
    ];
    $this->assertSame($expected, $this->migration->getProcess());
  }

}
+0 −4
Changes for core/modules/migrate_drupal_ui/src/Form/ReviewForm.php: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -80,10 +80,6 @@ class ReviewForm extends MigrateUpgradeFormBase {
  public function __construct(StateInterface $state, MigrationPluginManagerInterface $migration_plugin_manager, PrivateTempStoreFactory $tempstore_private, MigrationState $migrationState, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler = NULL) {
    parent::__construct($config_factory, $migration_plugin_manager, $state, $tempstore_private);
    $this->migrationState = $migrationState;
    if (!$module_handler) {
      @trigger_error('Calling ' . __METHOD__ . ' without the $module_handler argument is deprecated in drupal:9.1.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3136769', E_USER_DEPRECATED);
      $module_handler = \Drupal::service('module_handler');
    }
    $this->moduleHandler = $module_handler;
  }