diff --git a/core/modules/action/action.module b/core/modules/action/action.module index deb7d2557737c82a685971c5c902b95f95dc833e..0e4229debc4ec8ddadd42c4025f6987ab2a0b00d 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -8,6 +8,7 @@ use Drupal\Core\Url; use Drupal\action\Form\ActionAddForm; use Drupal\action\Form\ActionEditForm; +use Drupal\system\Plugin\migrate\source\Action; use Drupal\Core\Routing\RouteMatchInterface; /** @@ -52,3 +53,20 @@ function action_entity_type_build(array &$entity_types) { ->setLinkTemplate('edit-form', '/admin/config/system/actions/configure/{action}') ->setLinkTemplate('collection', '/admin/config/system/actions'); } + +/** + * Implements hook_migration_plugins_alter(). + */ +function action_migration_plugins_alter(array &$migrations) { + foreach ($migrations as $migration_id => $migration) { + // Add Actions plugins in actions module. + /** @var \Drupal\migrate\Plugin\migrate\source\SqlBase $source_plugin */ + $source_plugin = \Drupal::service('plugin.manager.migration') + ->createStubMigration($migration) + ->getSourcePlugin(); + if (is_a($source_plugin, Action::class) && isset($migration['process']['plugin'])) { + $migrations[$migration_id]['process']['plugin'][0]['map']['comment_unpublish_by_keyword_action'] = 'comment_unpublish_by_keyword_action'; + $migrations[$migration_id]['process']['plugin'][0]['map']['node_unpublish_by_keyword_action'] = 'node_unpublish_by_keyword_action'; + } + } +} diff --git a/core/modules/action/config/schema/action.schema.yml b/core/modules/action/config/schema/action.schema.yml new file mode 100644 index 0000000000000000000000000000000000000000..3627201766ef84b69319091c43de2ceda0175ca3 --- /dev/null +++ b/core/modules/action/config/schema/action.schema.yml @@ -0,0 +1,30 @@ +# Schema for the configuration files of the Action module. +action.configuration.comment_unpublish_by_keyword_action: + type: mapping + label: 'Unpublish comment containing keyword(s) configuration' + mapping: + keywords: + type: sequence + label: 'Keywords' + sequence: + type: string + label: 'Keyword' + +action.configuration.node_unpublish_by_keyword_action: + type: mapping + label: 'Unpublish content containing keyword(s) configuration' + mapping: + keywords: + type: sequence + label: 'Keywords' + sequence: + type: string + label: 'Keyword' + +action.configuration.node_assign_owner_action: + type: mapping + label: 'Change the author of content configuration' + mapping: + owner_uid: + type: text + label: 'Username' diff --git a/core/modules/action/src/Plugin/Action/AssignOwnerNode.php b/core/modules/action/src/Plugin/Action/AssignOwnerNode.php new file mode 100644 index 0000000000000000000000000000000000000000..6aad7da8f7c988d4a950f5227ea2f97e9106e2da --- /dev/null +++ b/core/modules/action/src/Plugin/Action/AssignOwnerNode.php @@ -0,0 +1,147 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\action\Plugin\Action; + +use Drupal\Core\Action\ConfigurableActionBase; +use Drupal\Core\Action\Attribute\Action; +use Drupal\Core\Database\Connection; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\user\Entity\User; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Assigns ownership of a node to a user. + */ +#[Action( + id: 'node_assign_owner_action', + label: new TranslatableMarkup('Change the author of content'), + type: 'node' +)] +class AssignOwnerNode extends ConfigurableActionBase implements ContainerFactoryPluginInterface { + + /** + * The database connection. + * + * @var \Drupal\Core\Database\Connection + */ + protected $connection; + + /** + * Constructs a new AssignOwnerNode action. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin ID for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Database\Connection $connection + * The database connection. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $connection) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + + $this->connection = $connection; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static($configuration, $plugin_id, $plugin_definition, + $container->get('database') + ); + } + + /** + * {@inheritdoc} + */ + public function execute($entity = NULL) { + /** @var \Drupal\node\NodeInterface $entity */ + $entity->setOwnerId($this->configuration['owner_uid'])->save(); + } + + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return [ + 'owner_uid' => '', + ]; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + $description = $this->t('The username of the user to which you would like to assign ownership.'); + $count = $this->connection->query("SELECT COUNT(*) FROM {users}")->fetchField(); + + // Use dropdown for fewer than 200 users; textbox for more than that. + if (intval($count) < 200) { + $options = []; + $result = $this->connection->query("SELECT [uid], [name] FROM {users_field_data} WHERE [uid] > 0 AND [default_langcode] = 1 ORDER BY [name]"); + foreach ($result as $data) { + $options[$data->uid] = $data->name; + } + $form['owner_uid'] = [ + '#type' => 'select', + '#title' => $this->t('Username'), + '#default_value' => $this->configuration['owner_uid'], + '#options' => $options, + '#description' => $description, + ]; + } + else { + $form['owner_uid'] = [ + '#type' => 'entity_autocomplete', + '#title' => $this->t('Username'), + '#target_type' => 'user', + '#selection_settings' => [ + 'include_anonymous' => FALSE, + ], + '#default_value' => User::load($this->configuration['owner_uid']), + // Validation is done in static::validateConfigurationForm(). + '#validate_reference' => FALSE, + '#size' => '6', + '#maxlength' => '60', + '#description' => $description, + ]; + } + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { + $exists = (bool) $this->connection->queryRange('SELECT 1 FROM {users_field_data} WHERE [uid] = :uid AND [default_langcode] = 1', 0, 1, [':uid' => $form_state->getValue('owner_uid')])->fetchField(); + if (!$exists) { + $form_state->setErrorByName('owner_uid', $this->t('Enter a valid username.')); + } + } + + /** + * {@inheritdoc} + */ + public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { + $this->configuration['owner_uid'] = $form_state->getValue('owner_uid'); + } + + /** + * {@inheritdoc} + */ + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { + /** @var \Drupal\node\NodeInterface $object */ + $result = $object->access('update', $account, TRUE) + ->andIf($object->getOwner()->access('edit', $account, TRUE)); + + return $return_as_object ? $result : $result->isAllowed(); + } + +} diff --git a/core/modules/action/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/action/src/Plugin/Action/UnpublishByKeywordComment.php new file mode 100644 index 0000000000000000000000000000000000000000..c859645f5cf50ebc6a3e5f5263ea8b14eb92a1f9 --- /dev/null +++ b/core/modules/action/src/Plugin/Action/UnpublishByKeywordComment.php @@ -0,0 +1,131 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\action\Plugin\Action; + +use Drupal\Component\Utility\Tags; +use Drupal\Core\Action\ConfigurableActionBase; +use Drupal\Core\Action\Attribute\Action; +use Drupal\Core\Entity\EntityViewBuilderInterface; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\Core\Render\RendererInterface; +use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * Unpublishes a comment containing certain keywords. + */ +#[Action( + id: 'comment_unpublish_by_keyword_action', + label: new TranslatableMarkup('Unpublish comment containing keyword(s)'), + type: 'comment' +)] +class UnpublishByKeywordComment extends ConfigurableActionBase implements ContainerFactoryPluginInterface { + + /** + * The comment entity builder handler. + * + * @var \Drupal\Core\Entity\EntityViewBuilderInterface + */ + protected $viewBuilder; + + /** + * The renderer. + * + * @var \Drupal\Core\Render\RendererInterface + */ + protected $renderer; + + /** + * Constructs an UnpublishByKeywordComment object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin ID for the plugin instance. + * @param mixed $plugin_definition + * The plugin implementation definition. + * @param \Drupal\Core\Entity\EntityViewBuilderInterface $comment_view_builder + * The comment entity builder handler. + * @param \Drupal\Core\Render\RendererInterface $renderer + * The renderer. + */ + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityViewBuilderInterface $comment_view_builder, RendererInterface $renderer) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + + $this->viewBuilder = $comment_view_builder; + $this->renderer = $renderer; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $container->get('entity_type.manager')->getViewBuilder('comment'), + $container->get('renderer') + ); + } + + /** + * {@inheritdoc} + */ + public function execute($comment = NULL) { + $build = $this->viewBuilder->view($comment); + $text = (string) $this->renderer->renderInIsolation($build); + foreach ($this->configuration['keywords'] as $keyword) { + if (str_contains($text, $keyword)) { + $comment->setUnpublished(); + $comment->save(); + break; + } + } + } + + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return [ + 'keywords' => [], + ]; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + $form['keywords'] = [ + '#title' => $this->t('Keywords'), + '#type' => 'textarea', + '#description' => $this->t('The comment will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'), + '#default_value' => Tags::implode($this->configuration['keywords']), + ]; + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { + $this->configuration['keywords'] = Tags::explode($form_state->getValue('keywords')); + } + + /** + * {@inheritdoc} + */ + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { + /** @var \Drupal\comment\CommentInterface $object */ + $result = $object->access('update', $account, TRUE) + ->andIf($object->status->access('edit', $account, TRUE)); + + return $return_as_object ? $result : $result->isAllowed(); + } + +} diff --git a/core/modules/action/src/Plugin/Action/UnpublishByKeywordNode.php b/core/modules/action/src/Plugin/Action/UnpublishByKeywordNode.php new file mode 100644 index 0000000000000000000000000000000000000000..66885635fdb5034ac2c45ab9c75e84b917332911 --- /dev/null +++ b/core/modules/action/src/Plugin/Action/UnpublishByKeywordNode.php @@ -0,0 +1,81 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\action\Plugin\Action; + +use Drupal\Component\Utility\Tags; +use Drupal\Core\Action\ConfigurableActionBase; +use Drupal\Core\Action\Attribute\Action; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Session\AccountInterface; +use Drupal\Core\StringTranslation\TranslatableMarkup; + +/** + * Unpublishes a node containing certain keywords. + */ +#[Action( + id: 'node_unpublish_by_keyword_action', + label: new TranslatableMarkup('Unpublish content containing keyword(s)'), + type: 'node' +)] +class UnpublishByKeywordNode extends ConfigurableActionBase { + + /** + * {@inheritdoc} + */ + public function execute($node = NULL) { + $elements = \Drupal::entityTypeManager() + ->getViewBuilder('node') + ->view(clone $node); + $render = (string) \Drupal::service('renderer')->renderInIsolation($elements); + foreach ($this->configuration['keywords'] as $keyword) { + if (str_contains($render, $keyword) || str_contains($node->label(), $keyword)) { + $node->setUnpublished(); + $node->save(); + break; + } + } + } + + /** + * {@inheritdoc} + */ + public function defaultConfiguration() { + return [ + 'keywords' => [], + ]; + } + + /** + * {@inheritdoc} + */ + public function buildConfigurationForm(array $form, FormStateInterface $form_state) { + $form['keywords'] = [ + '#title' => $this->t('Keywords'), + '#type' => 'textarea', + '#description' => $this->t('The content will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'), + '#default_value' => Tags::implode($this->configuration['keywords']), + ]; + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { + $this->configuration['keywords'] = Tags::explode($form_state->getValue('keywords')); + } + + /** + * {@inheritdoc} + */ + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { + /** @var \Drupal\node\NodeInterface $object */ + $access = $object->access('update', $account, TRUE) + ->andIf($object->status->access('edit', $account, TRUE)); + + return $return_as_object ? $access : $access->isAllowed(); + } + +} diff --git a/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php b/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0ad84dd9254bcd7a2ace438e609e0bb1dc434388 --- /dev/null +++ b/core/modules/action/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php @@ -0,0 +1,59 @@ +<?php + +namespace Drupal\Tests\action\Kernel\Migrate\d6; + +use Drupal\system\Entity\Action; +use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; + +/** + * Tests migration of action items. + * + * @group migrate_drupal_6 + */ +class MigrateActionsTest extends MigrateDrupal6TestBase { + + protected static $modules = ['action', 'comment', 'node']; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + $this->executeMigration('d6_action'); + } + + /** + * Tests Drupal 6 action migration to Drupal 8. + */ + public function testActions() { + // Test advanced actions. + $this->assertEntity('unpublish_comment_containing_keyword_s_', 'Unpublish comment containing keyword(s)', 'comment', ["keywords" => [0 => "drupal"]]); + $this->assertEntity('unpublish_post_containing_keyword_s_', 'Unpublish post containing keyword(s)', 'node', ["keywords" => [0 => "drupal"]]); + } + + /** + * Asserts various aspects of an Action entity. + * + * @param string $id + * The expected Action ID. + * @param string $label + * The expected Action label. + * @param string $type + * The expected Action type. + * @param array $configuration + * The expected Action configuration. + * + * @internal + */ + protected function assertEntity(string $id, string $label, string $type, array $configuration): void { + $action = Action::load($id); + + $this->assertInstanceOf(Action::class, $action); + /** @var \Drupal\system\Entity\Action $action */ + $this->assertSame($id, $action->id()); + $this->assertSame($label, $action->label()); + $this->assertSame($type, $action->getType()); + $this->assertSame($configuration, $action->get('configuration')); + } + +} diff --git a/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php b/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9801847183d3687a017ccadb086768d7c1937e81 --- /dev/null +++ b/core/modules/action/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php @@ -0,0 +1,59 @@ +<?php + +namespace Drupal\Tests\action\Kernel\Migrate\d7; + +use Drupal\system\Entity\Action; +use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; + +/** + * Tests migration of action items. + * + * @group action + */ +class MigrateActionsTest extends MigrateDrupal7TestBase { + + protected static $modules = ['action', 'comment', 'node']; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + $this->executeMigration('d7_action'); + } + + /** + * Tests Drupal 7 action migration to Drupal 8. + */ + public function testActions() { + // Test advanced actions. + $this->assertEntity('unpublish_comment_containing_keyword_s_', 'Unpublish comment containing keyword(s)', 'comment', ["keywords" => [0 => "drupal"]]); + $this->assertEntity('unpublish_content_containing_keyword_s_', 'Unpublish content containing keyword(s)', 'node', ["keywords" => [0 => "drupal"]]); + } + + /** + * Asserts various aspects of an Action entity. + * + * @param string $id + * The expected Action ID. + * @param string $label + * The expected Action label. + * @param string $type + * The expected Action type. + * @param array $configuration + * The expected Action configuration. + * + * @internal + */ + protected function assertEntity(string $id, string $label, string $type, array $configuration): void { + $action = Action::load($id); + + $this->assertInstanceOf(Action::class, $action); + /** @var \Drupal\system\Entity\Action $action */ + $this->assertSame($id, $action->id()); + $this->assertSame($label, $action->label()); + $this->assertSame($type, $action->getType()); + $this->assertSame($configuration, $action->get('configuration')); + } + +} diff --git a/core/modules/node/tests/src/Kernel/Action/UnpublishByKeywordActionTest.php b/core/modules/action/tests/src/Kernel/UnpublishByKeywordActionTest.php similarity index 93% rename from core/modules/node/tests/src/Kernel/Action/UnpublishByKeywordActionTest.php rename to core/modules/action/tests/src/Kernel/UnpublishByKeywordActionTest.php index 779633065b20ebe27f2de96309c78d0c4aec9a3c..4019f5179c1cab0f879bd184d236789e5091616b 100644 --- a/core/modules/node/tests/src/Kernel/Action/UnpublishByKeywordActionTest.php +++ b/core/modules/action/tests/src/Kernel/UnpublishByKeywordActionTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\node\Kernel\Action; +namespace Drupal\Tests\action\Kernel; use Drupal\Core\Render\RenderContext; use Drupal\KernelTests\KernelTestBase; @@ -9,14 +9,14 @@ use Drupal\system\Entity\Action; /** - * @group node + * @group action */ class UnpublishByKeywordActionTest extends KernelTestBase { /** * {@inheritdoc} */ - protected static $modules = ['node', 'system', 'user', 'field']; + protected static $modules = ['action', 'node', 'system', 'user', 'field']; /** * {@inheritdoc} diff --git a/core/modules/comment/tests/src/Kernel/CommentActionsTest.php b/core/modules/action/tests/src/Kernel/UnpublishByKeywordCommentTest.php similarity index 95% rename from core/modules/comment/tests/src/Kernel/CommentActionsTest.php rename to core/modules/action/tests/src/Kernel/UnpublishByKeywordCommentTest.php index 525c58b09deefedac13510b0a8778af8f7d1e874..4b5daef05bb84c2a87328a7d9c4f768315b37514 100644 --- a/core/modules/comment/tests/src/Kernel/CommentActionsTest.php +++ b/core/modules/action/tests/src/Kernel/UnpublishByKeywordCommentTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\Tests\comment\Kernel; +namespace Drupal\Tests\action\Kernel; use Drupal\comment\Entity\Comment; use Drupal\comment\Entity\CommentType; @@ -12,17 +12,17 @@ use Drupal\system\Entity\Action; /** - * Tests actions provided by the Comment module. + * {@inheritdoc} * - * @group comment + * @group action */ -class CommentActionsTest extends EntityKernelTestBase { +class UnpublishByKeywordCommentTest extends EntityKernelTestBase { use CommentTestTrait; /** * {@inheritdoc} */ - protected static $modules = ['comment', 'entity_test']; + protected static $modules = ['action', 'comment', 'entity_test']; /** * Keywords used for testing. diff --git a/core/modules/comment/config/schema/comment.schema.yml b/core/modules/comment/config/schema/comment.schema.yml index 87d5a45a3454eb5647a8eacb14b19996f418eb78..33b3e55ac3ab7ea9f22df95e8f06bcde6e5edd6b 100644 --- a/core/modules/comment/config/schema/comment.schema.yml +++ b/core/modules/comment/config/schema/comment.schema.yml @@ -24,17 +24,6 @@ field.widget.settings.comment_default: type: mapping label: 'Comment display format settings' -action.configuration.comment_unpublish_by_keyword_action: - type: mapping - label: 'Unpublish comment containing keyword(s) configuration' - mapping: - keywords: - type: sequence - label: 'Keywords' - sequence: - type: string - label: 'Keyword' - comment.type.*: type: config_entity label: 'Comment type settings' diff --git a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php index fd26bbc58e4c57cc137c6f34bdb97e7eb5fdd374..be16b10a4e0373f1620e69611fedbdf08110fc87 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php @@ -2,128 +2,26 @@ namespace Drupal\comment\Plugin\Action; -use Drupal\Component\Utility\Tags; -use Drupal\Core\Action\ConfigurableActionBase; -use Drupal\Core\Action\Attribute\Action; +use Drupal\action\Plugin\Action\UnpublishByKeywordComment as ActionUnpublishByKeywordComment; use Drupal\Core\Entity\EntityViewBuilderInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Render\RendererInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\StringTranslation\TranslatableMarkup; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Unpublishes a comment containing certain keywords. + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use + * \Drupal\action\Plugin\Action\UnpublishByKeywordComment instead. + * + * @see https://www.drupal.org/node/3424506 */ -#[Action( - id: 'comment_unpublish_by_keyword_action', - label: new TranslatableMarkup('Unpublish comment containing keyword(s)'), - type: 'comment' -)] -class UnpublishByKeywordComment extends ConfigurableActionBase implements ContainerFactoryPluginInterface { - - /** - * The comment entity builder handler. - * - * @var \Drupal\Core\Entity\EntityViewBuilderInterface - */ - protected $viewBuilder; - - /** - * The renderer. - * - * @var \Drupal\Core\Render\RendererInterface - */ - protected $renderer; - - /** - * Constructs an UnpublishByKeywordComment object. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin ID for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Entity\EntityViewBuilderInterface $comment_view_builder - * The comment entity builder handler. - * @param \Drupal\Core\Render\RendererInterface $renderer - * The renderer. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityViewBuilderInterface $comment_view_builder, RendererInterface $renderer) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->viewBuilder = $comment_view_builder; - $this->renderer = $renderer; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager')->getViewBuilder('comment'), - $container->get('renderer') - ); - } +class UnpublishByKeywordComment extends ActionUnpublishByKeywordComment { /** * {@inheritdoc} */ - public function execute($comment = NULL) { - $build = $this->viewBuilder->view($comment); - $text = $this->renderer->renderInIsolation($build); - foreach ($this->configuration['keywords'] as $keyword) { - if (str_contains($text, $keyword)) { - $comment->setUnpublished(); - $comment->save(); - break; - } - } - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return [ - 'keywords' => [], - ]; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $form['keywords'] = [ - '#title' => $this->t('Keywords'), - '#type' => 'textarea', - '#description' => $this->t('The comment will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'), - '#default_value' => Tags::implode($this->configuration['keywords']), - ]; - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - $this->configuration['keywords'] = Tags::explode($form_state->getValue('keywords')); - } - - /** - * {@inheritdoc} - */ - public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { - /** @var \Drupal\comment\CommentInterface $object */ - $result = $object->access('update', $account, TRUE) - ->andIf($object->status->access('edit', $account, TRUE)); - - return $return_as_object ? $result : $result->isAllowed(); + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityViewBuilderInterface $comment_view_builder, RendererInterface $renderer) { + @trigger_error(__CLASS__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\UnpublishByKeywordComment instead. See https://www.drupal.org/node/3424506', E_USER_DEPRECATED); + parent::__construct($configuration, $plugin_id, $plugin_definition, $comment_view_builder, $renderer); } } diff --git a/core/modules/comment/tests/src/Unit/Action/UnpublishByKeywordCommentTest.php b/core/modules/comment/tests/src/Unit/Action/UnpublishByKeywordCommentTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b7e0e7ea867c07c9dc18496e1a962e2860a5c3f0 --- /dev/null +++ b/core/modules/comment/tests/src/Unit/Action/UnpublishByKeywordCommentTest.php @@ -0,0 +1,28 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\Tests\comment\Unit\Action; + +use Drupal\comment\Plugin\Action\UnpublishByKeywordComment; +use Drupal\Core\Entity\EntityViewBuilderInterface; +use Drupal\Core\Render\RendererInterface; +use Drupal\Tests\UnitTestCase; + +/** + * @group comment + * @group legacy + */ +class UnpublishByKeywordCommentTest extends UnitTestCase { + + /** + * Tests deprecation message. + */ + public function testUnpublishByKeywordAction() { + $comment_view_builder = $this->createMock(EntityViewBuilderInterface::class); + $renderer = $this->createMock(RendererInterface::class); + $this->expectDeprecation('Drupal\comment\Plugin\Action\UnpublishByKeywordComment is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\UnpublishByKeywordComment instead. See https://www.drupal.org/node/3424506'); + $this->assertIsObject(new UnpublishByKeywordComment([], 'foo', [], $comment_view_builder, $renderer)); + } + +} diff --git a/core/modules/forum/tests/src/Functional/migrate_drupal/d6/Upgrade6Test.php b/core/modules/forum/tests/src/Functional/migrate_drupal/d6/Upgrade6Test.php index a8d90bdfe2d69e3b801c3d9bb07976b7095dcef1..8a8a8fc0140024f401afd7b83c5500335daabda6 100644 --- a/core/modules/forum/tests/src/Functional/migrate_drupal/d6/Upgrade6Test.php +++ b/core/modules/forum/tests/src/Functional/migrate_drupal/d6/Upgrade6Test.php @@ -52,7 +52,7 @@ protected function getSourceBasePath() { */ protected function getEntityCounts() { return [ - 'action' => 27, + 'action' => 24, 'base_field_override' => 22, 'block' => 33, 'block_content' => 1, diff --git a/core/modules/forum/tests/src/Functional/migrate_drupal/d7/Upgrade7Test.php b/core/modules/forum/tests/src/Functional/migrate_drupal/d7/Upgrade7Test.php index bb7660b367e1abce67d2aabc6f846a34d0c7a80b..09c360464055d93fa25b0cedcac4adb6d3f642e1 100644 --- a/core/modules/forum/tests/src/Functional/migrate_drupal/d7/Upgrade7Test.php +++ b/core/modules/forum/tests/src/Functional/migrate_drupal/d7/Upgrade7Test.php @@ -63,7 +63,7 @@ protected function getSourceBasePath() { */ protected function getEntityCounts() { return [ - 'action' => 27, + 'action' => 24, 'base_field_override' => 3, 'block' => 26, 'block_content' => 1, diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php index 2daba096b76c03b16f3211a39f36d7c33f606b8f..80aeb2697e267b53817c4bbdd6407b05cc887776 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/Upgrade6Test.php @@ -96,7 +96,7 @@ protected function getEntityCounts() { 'search_page' => 3, 'shortcut' => 2, 'shortcut_set' => 1, - 'action' => 33, + 'action' => 30, 'menu' => 8, 'path_alias' => 8, 'taxonomy_term' => 15, diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php index bf3cff61ad192176a7af4a9016450988c6a83335..327e86167f25c0de49b1dcb8df04f51d62d54946 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php @@ -99,7 +99,7 @@ protected function getEntityCounts() { 'search_page' => 3, 'shortcut' => 6, 'shortcut_set' => 2, - 'action' => 27, + 'action' => 24, 'menu' => 7, 'taxonomy_term' => 25, 'taxonomy_vocabulary' => 8, diff --git a/core/modules/node/config/schema/node.schema.yml b/core/modules/node/config/schema/node.schema.yml index 1c6e759964f3a1dbb9d089c5e9b374b38293c9a8..08fe92cc401e4ec5d4996362302c2f670866fedc 100644 --- a/core/modules/node/config/schema/node.schema.yml +++ b/core/modules/node/config/schema/node.schema.yml @@ -69,14 +69,6 @@ search.plugin.node_search: type: integer label: 'Influence' -action.configuration.node_assign_owner_action: - type: mapping - label: 'Change the author of content configuration' - mapping: - owner_uid: - type: text - label: 'Username' - action.configuration.node_unpromote_action: type: action_configuration_default label: 'Demote selected content from front page configuration' @@ -93,17 +85,6 @@ action.configuration.node_make_unsticky_action: type: action_configuration_default label: 'Make selected content unsticky configuration' -action.configuration.node_unpublish_by_keyword_action: - type: mapping - label: 'Unpublish content containing keyword(s) configuration' - mapping: - keywords: - type: sequence - label: 'Keywords' - sequence: - type: string - label: 'Keyword' - block.settings.node_syndicate_block: type: block_settings label: 'Syndicate block' diff --git a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php index e764f91a478a6e1dd7c2a8eec9b1bf4cf6b5c051..8e4bbf17047bf53ab266da519b7134fa4e36862c 100644 --- a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php +++ b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php @@ -2,144 +2,25 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Action\ConfigurableActionBase; -use Drupal\Core\Action\Attribute\Action; use Drupal\Core\Database\Connection; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\StringTranslation\TranslatableMarkup; -use Drupal\user\Entity\User; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\action\Plugin\Action\AssignOwnerNode as ActionAssignOwnerNode; /** * Assigns ownership of a node to a user. + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use + * \Drupal\action\Plugin\Action\AssignOwnerNode instead. + * + * @see https://www.drupal.org/node/3424506 */ -#[Action( - id: 'node_assign_owner_action', - label: new TranslatableMarkup('Change the author of content'), - type: 'node' -)] -class AssignOwnerNode extends ConfigurableActionBase implements ContainerFactoryPluginInterface { - - /** - * The database connection. - * - * @var \Drupal\Core\Database\Connection - */ - protected $connection; - - /** - * Constructs a new AssignOwnerNode action. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin ID for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Database\Connection $connection - * The database connection. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $connection) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->connection = $connection; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, - $container->get('database') - ); - } - - /** - * {@inheritdoc} - */ - public function execute($entity = NULL) { - /** @var \Drupal\node\NodeInterface $entity */ - $entity->setOwnerId($this->configuration['owner_uid'])->save(); - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return [ - 'owner_uid' => '', - ]; - } +class AssignOwnerNode extends ActionAssignOwnerNode { /** * {@inheritdoc} */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $description = $this->t('The username of the user to which you would like to assign ownership.'); - $count = $this->connection->query("SELECT COUNT(*) FROM {users}")->fetchField(); - - // Use dropdown for fewer than 200 users; textbox for more than that. - if (intval($count) < 200) { - $options = []; - $result = $this->connection->query("SELECT [uid], [name] FROM {users_field_data} WHERE [uid] > 0 AND [default_langcode] = 1 ORDER BY [name]"); - foreach ($result as $data) { - $options[$data->uid] = $data->name; - } - $form['owner_uid'] = [ - '#type' => 'select', - '#title' => $this->t('Username'), - '#default_value' => $this->configuration['owner_uid'], - '#options' => $options, - '#description' => $description, - ]; - } - else { - $form['owner_uid'] = [ - '#type' => 'entity_autocomplete', - '#title' => $this->t('Username'), - '#target_type' => 'user', - '#selection_settings' => [ - 'include_anonymous' => FALSE, - ], - '#default_value' => User::load($this->configuration['owner_uid']), - // Validation is done in static::validateConfigurationForm(). - '#validate_reference' => FALSE, - '#size' => '6', - '#maxlength' => '60', - '#description' => $description, - ]; - } - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - $exists = (bool) $this->connection->queryRange('SELECT 1 FROM {users_field_data} WHERE [uid] = :uid AND [default_langcode] = 1', 0, 1, [':uid' => $form_state->getValue('owner_uid')])->fetchField(); - if (!$exists) { - $form_state->setErrorByName('owner_uid', $this->t('Enter a valid username.')); - } - } - - /** - * {@inheritdoc} - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - $this->configuration['owner_uid'] = $form_state->getValue('owner_uid'); - } - - /** - * {@inheritdoc} - */ - public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { - /** @var \Drupal\node\NodeInterface $object */ - $result = $object->access('update', $account, TRUE) - ->andIf($object->getOwner()->access('edit', $account, TRUE)); - - return $return_as_object ? $result : $result->isAllowed(); + public function __construct(array $configuration, $plugin_id, $plugin_definition, Connection $connection) { + @trigger_error(__CLASS__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\AssignOwnerNode instead. See https://www.drupal.org/node/3424506', E_USER_DEPRECATED); + parent::__construct($configuration, $plugin_id, $plugin_definition, $connection); } } diff --git a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php index ffe0e5e255b49a3592ce473731310ad71515de92..3d9976462591e093999f6cf42e6f412340e73b6c 100644 --- a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php +++ b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php @@ -2,78 +2,24 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Component\Utility\Tags; -use Drupal\Core\Action\ConfigurableActionBase; -use Drupal\Core\Action\Attribute\Action; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\action\Plugin\Action\UnpublishByKeywordNode as ActionUnpublishByKeywordNode; /** * Unpublishes a node containing certain keywords. + * + * @deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use + * \Drupal\action\Plugin\Action\UnpublishByKeywordNode instead. + * + * @see https://www.drupal.org/node/3424506 */ -#[Action( - id: 'node_unpublish_by_keyword_action', - label: new TranslatableMarkup('Unpublish content containing keyword(s)'), - type: 'node' -)] -class UnpublishByKeywordNode extends ConfigurableActionBase { +class UnpublishByKeywordNode extends ActionUnpublishByKeywordNode { /** * {@inheritdoc} */ - public function execute($node = NULL) { - $elements = \Drupal::entityTypeManager() - ->getViewBuilder('node') - ->view(clone $node); - $render = \Drupal::service('renderer')->render($elements); - foreach ($this->configuration['keywords'] as $keyword) { - if (str_contains($render, $keyword) || str_contains($node->label(), $keyword)) { - $node->setUnpublished(); - $node->save(); - break; - } - } - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return [ - 'keywords' => [], - ]; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $form['keywords'] = [ - '#title' => $this->t('Keywords'), - '#type' => 'textarea', - '#description' => $this->t('The content will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'), - '#default_value' => Tags::implode($this->configuration['keywords']), - ]; - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - $this->configuration['keywords'] = Tags::explode($form_state->getValue('keywords')); - } - - /** - * {@inheritdoc} - */ - public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { - /** @var \Drupal\node\NodeInterface $object */ - $access = $object->access('update', $account, TRUE) - ->andIf($object->status->access('edit', $account, TRUE)); - - return $return_as_object ? $access : $access->isAllowed(); + public function __construct(array $configuration, $plugin_id, $plugin_definition) { + @trigger_error(__CLASS__ . ' is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\UnpublishByKeywordNode instead. See https://www.drupal.org/node/3424506', E_USER_DEPRECATED); + parent::__construct($configuration, $plugin_id, $plugin_definition); } } diff --git a/core/modules/node/tests/src/Unit/Action/AssignOwnerNodeTest.php b/core/modules/node/tests/src/Unit/Action/AssignOwnerNodeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3f73f90be85fd6bbb07fbdf41f371d1a7c5703e0 --- /dev/null +++ b/core/modules/node/tests/src/Unit/Action/AssignOwnerNodeTest.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\Tests\node\Unit\Action; + +use Drupal\Core\Database\Connection; +use Drupal\node\Plugin\Action\AssignOwnerNode; +use Drupal\Tests\UnitTestCase; + +/** + * @group node + * @group legacy + */ +class AssignOwnerNodeTest extends UnitTestCase { + + /** + * Tests deprecation of \Drupal\node\Plugin\Action\AssignOwnerNodeTest. + */ + public function testAssignOwnerNode() { + $this->expectDeprecation('Drupal\node\Plugin\Action\AssignOwnerNode is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\AssignOwnerNode instead. See https://www.drupal.org/node/3424506'); + $this->assertIsObject(new AssignOwnerNode([], 'foo', [], $this->prophesize(Connection::class)->reveal())); + } + +} diff --git a/core/modules/node/tests/src/Unit/Action/UnpublishByKeywordActionTest.php b/core/modules/node/tests/src/Unit/Action/UnpublishByKeywordActionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..26ac76cbb9000e69e337648aa0d201deb2c35953 --- /dev/null +++ b/core/modules/node/tests/src/Unit/Action/UnpublishByKeywordActionTest.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\Tests\node\Unit\Action; + +use Drupal\node\Plugin\Action\UnpublishByKeywordNode; +use Drupal\Tests\UnitTestCase; + +/** + * @group node + * @group legacy + */ +class UnpublishByKeywordActionTest extends UnitTestCase { + + /** + * Tests deprecation of \Drupal\node\Plugin\Action\UnpublishByKeywordNode. + */ + public function testUnpublishByKeywordAction() { + $this->expectDeprecation('Drupal\node\Plugin\Action\UnpublishByKeywordNode is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use \Drupal\action\Plugin\Action\UnpublishByKeywordNode instead. See https://www.drupal.org/node/3424506'); + $this->assertIsObject(new UnpublishByKeywordNode([], 'foo', [])); + } + +} diff --git a/core/modules/statistics/tests/src/Functional/migrate_drupal/d6/UpgradeTest.php b/core/modules/statistics/tests/src/Functional/migrate_drupal/d6/UpgradeTest.php index 8b77e47b3af9528f12a779a1fb91fa8a40835719..b90f82856930bffc444d19bfe806e2ac639edf53 100644 --- a/core/modules/statistics/tests/src/Functional/migrate_drupal/d6/UpgradeTest.php +++ b/core/modules/statistics/tests/src/Functional/migrate_drupal/d6/UpgradeTest.php @@ -53,7 +53,7 @@ protected function getSourceBasePath() { */ protected function getEntityCounts() { return [ - 'action' => 27, + 'action' => 24, 'base_field_override' => 18, 'block' => 33, 'block_content' => 1, diff --git a/core/modules/statistics/tests/src/Functional/migrate_drupal/d7/UpgradeTest.php b/core/modules/statistics/tests/src/Functional/migrate_drupal/d7/UpgradeTest.php index 539ca6fe57098cb4493d792c21f3c18c9855a670..4e8bcfd3643969bb5b16b0b2179917ffbe0d0b60 100644 --- a/core/modules/statistics/tests/src/Functional/migrate_drupal/d7/UpgradeTest.php +++ b/core/modules/statistics/tests/src/Functional/migrate_drupal/d7/UpgradeTest.php @@ -68,7 +68,7 @@ protected function getSourceBasePath() { */ protected function getEntityCounts() { return [ - 'action' => 27, + 'action' => 24, 'base_field_override' => 3, 'block' => 27, 'block_content' => 1, diff --git a/core/modules/system/migrations/d6_action.yml b/core/modules/system/migrations/d6_action.yml index f9df68296cb2eb2738026173014b5bb09ee636c9..03941fa898223a792b5dcd596672dbdcff7be806 100644 --- a/core/modules/system/migrations/d6_action.yml +++ b/core/modules/system/migrations/d6_action.yml @@ -31,6 +31,9 @@ process: node_publish_action: entity:publish_action:node node_unpublish_action: entity:unpublish_action:node node_save_action: entity:save_action:node + comment_unpublish_by_keyword_action: 0 + node_unpublish_by_keyword_action: 0 + node_assign_owner_action: 0 bypass: true - plugin: skip_on_empty diff --git a/core/modules/system/migrations/d7_action.yml b/core/modules/system/migrations/d7_action.yml index 21a83aa40451a6ebe1c392b7ebce47701a57ce6a..c210cf2d28491e9abb1d51d440ee38f08e5404c1 100644 --- a/core/modules/system/migrations/d7_action.yml +++ b/core/modules/system/migrations/d7_action.yml @@ -27,6 +27,9 @@ process: node_publish_action: entity:publish_action:node node_unpublish_action: entity:unpublish_action:node node_save_action: entity:save_action:node + comment_unpublish_by_keyword_action: 0 + node_unpublish_by_keyword_action: 0 + node_assign_owner_action: 0 bypass: true - plugin: skip_on_empty diff --git a/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php b/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php index deb65d08171966cb32f554805abd322e5861b62f..198ced3024e29178a8b05f552420d41bbef9c3ce 100644 --- a/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php +++ b/core/modules/system/tests/src/Kernel/Migrate/d6/MigrateActionsTest.php @@ -33,9 +33,6 @@ public function testActions() { $this->assertEntity('comment_publish_action', 'Publish comment', 'comment', []); // Test advanced actions. - $this->assertEntity('unpublish_comment_containing_keyword_s_', 'Unpublish comment containing keyword(s)', 'comment', ["keywords" => [0 => "drupal"]]); - $this->assertEntity('change_the_author_of_a_post', 'Change the author of a post', 'node', ["owner_uid" => "2"]); - $this->assertEntity('unpublish_post_containing_keyword_s_', 'Unpublish post containing keyword(s)', 'node', ["keywords" => [0 => "drupal"]]); $this->assertEntity('display_a_message_to_the_user', 'Display a message to the user', 'system', ["message" => "Drupal migration test"]); $this->assertEntity('send_e_mail', 'Send e-mail', 'system', [ "recipient" => "test@example.com", diff --git a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php index 395703524dcc9468194d177a756a4ccca23958eb..82c13832697d4e48c5d45b7b261fc7f3cd95fdcf 100644 --- a/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php +++ b/core/modules/system/tests/src/Kernel/Migrate/d7/MigrateActionsTest.php @@ -33,9 +33,6 @@ public function testActions() { $this->assertEntity('comment_publish_action', 'Publish comment', 'comment', []); // Test advanced actions. - $this->assertEntity('unpublish_comment_containing_keyword_s_', 'Unpublish comment containing keyword(s)', 'comment', ["keywords" => [0 => "drupal"]]); - $this->assertEntity('change_the_author_of_content', 'Change the author of content', 'node', ["owner_uid" => "2"]); - $this->assertEntity('unpublish_content_containing_keyword_s_', 'Unpublish content containing keyword(s)', 'node', ["keywords" => [0 => "drupal"]]); $this->assertEntity('display_a_message_to_the_user', 'Display a message to the user', 'system', ["message" => "Drupal migration test"]); $this->assertEntity('send_e_mail', 'Send e-mail', 'system', [ "recipient" => "test@example.com",