ActionTest.php 1.54 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

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

use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;

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

  /**
   * {@inheritdoc}
   */
18
  public static $modules = ['action', 'migrate_drupal', 'system'];
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

  /**
   * {@inheritdoc}
   */
  public function providerSource() {
    $tests = [];

    $tests[0][0]['actions'] = [
      [
        'aid' => 'Redirect to node list page',
        'type' => 'system',
        'callback' => 'system_goto_action',
        'parameters' => 'a:1:{s:3:"url";s:4:"node";}',
        'description' => 'Redirect to node list page',
      ],
      [
        'aid' => 'Test notice email',
        'type' => 'system',
        'callback' => 'system_send_email_action',
        'parameters' => 'a:3:{s:9:"recipient";s:7:"%author";s:7:"subject";s:4:"Test";s:7:"message";s:4:"Test',
        'description' => 'Test notice email',
      ],
      [
        'aid' => 'comment_publish_action',
        'type' => 'comment',
        'callback' => 'comment_publish_action',
        'parameters' => NULL,
        'description' => NULL,
      ],
      [
        'aid' => 'node_publish_action',
        'type' => 'comment',
        'callback' => 'node_publish_action',
        'parameters' => NULL,
        'description' => NULL,
      ],
    ];
    // The expected results are identical to the source data.
    $tests[0][1] = $tests[0][0]['actions'];

    return $tests;
  }

}