Commit c550b6e8 authored by catch's avatar catch
Browse files

Issue #3067299 by andypost, iyyappan.govind, quietone, mrinalini9,...

Issue #3067299 by andypost, iyyappan.govind, quietone, mrinalini9, benjifisher, ravi.shankar, yogeshmpawar, longwave, danflanagan8: Move actions migrations and tests to system module
parent 305d1207
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
finished:
  6:
    system: action
  7:
    system: action
+8 −59
Original line number Diff line number Diff line
@@ -2,8 +2,9 @@

namespace Drupal\action\Plugin\migrate\source;

use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
use Drupal\migrate\Row;
@trigger_error('The ' . __NAMESPACE__ . '\Action is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use \Drupal\system\Plugin\migrate\source\Action instead. See https://www.drupal.org/node/3110401', E_USER_DEPRECATED);

use Drupal\system\Plugin\migrate\source\Action as SystemAction;

/**
 * Drupal 6/7 action source from database.
@@ -13,63 +14,11 @@
 * @see \Drupal\migrate\Plugin\migrate\source\SqlBase
 * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
 *
 * @MigrateSource(
 *   id = "action",
 *   source_module = "system"
 * )
 */
class Action extends DrupalSqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    return $this->select('actions', 'a')
      ->fields('a');
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    $fields = [
      'aid' => $this->t('Action ID'),
      'type' => $this->t('Module'),
      'callback' => $this->t('Callback function'),
      'parameters' => $this->t('Action configuration'),
    ];
    if ($this->getModuleSchemaVersion('system') >= 7000) {
      $fields['label'] = $this->t('Label of the action');
    }
    else {
      $fields['description'] = $this->t('Action description');
    }
    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['aid']['type'] = 'string';
    return $ids;
  }

  /**
   * {@inheritdoc}
 * @deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use
 *   \Drupal\system\Plugin\migrate\source\Action instead.
 *
 * @see https://www.drupal.org/node/3110401
 */
  public function prepareRow(Row $row) {
    $aid = $row->getSourceProperty('aid');
    if (is_numeric($aid)) {
      if ($this->getModuleSchemaVersion('system') >= 7000) {
        $label = $row->getSourceProperty('label');
      }
      else {
        $label = $row->getSourceProperty('description');
      }
      $row->setSourceProperty('aid', $label);
    }
    return parent::prepareRow($row);
  }
class Action extends SystemAction {

}
+31 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\action\Unit\Plugin\migrate\source;

use Drupal\action\Plugin\migrate\source\Action;
use Drupal\Tests\migrate\Unit\MigrateTestCase;

/**
 * Tests actions source plugin.
 *
 * @covers \Drupal\action\Plugin\migrate\source\Action
 * @group legacy
 */
class ActionTest extends MigrateTestCase {

  /**
   * Tests deprecation of Action plugin.
   */
  public function testDeprecatedPlugin() {
    $this->expectDeprecation("The Drupal\action\Plugin\migrate\source\Action is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use \Drupal\system\Plugin\migrate\source\Action instead. See https://www.drupal.org/node/3110401");
    new Action(
      [],
      'action',
      [],
      $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal(),
      $this->prophesize('Drupal\Core\State\StateInterface')->reveal(),
      $this->prophesize('Drupal\Core\Entity\EntityTypeManagerInterface')->reveal()
    );
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ protected function getEntityCounts() {
      'search_page' => 2,
      'shortcut' => 2,
      'shortcut_set' => 1,
      'action' => 27,
      'action' => 33,
      'menu' => 8,
      'path_alias' => 8,
      'taxonomy_term' => 15,
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ protected function getEntityCounts() {
      'search_page' => 2,
      'shortcut' => 6,
      'shortcut_set' => 2,
      'action' => 21,
      'action' => 27,
      'menu' => 7,
      'taxonomy_term' => 25,
      'taxonomy_vocabulary' => 8,
Loading