7f7b7ef8cd6d58386d8df389ef7884eff8947462
[yaffs-website] / source / ActionTest.php
1 <?php
2
3 namespace Drupal\Tests\action\Kernel\Plugin\migrate\source;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests actions source plugin.
9  *
10  * @covers \Drupal\action\Plugin\migrate\source\Action
11  * @group action
12  */
13 class ActionTest extends MigrateSqlSourceTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['action', 'migrate_drupal'];
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providerSource() {
24     $tests = [];
25
26     $tests[0][0]['actions'] = [
27       [
28         'aid' => 'Redirect to node list page',
29         'type' => 'system',
30         'callback' => 'system_goto_action',
31         'parameters' => 'a:1:{s:3:"url";s:4:"node";}',
32         'description' => 'Redirect to node list page',
33       ],
34       [
35         'aid' => 'Test notice email',
36         'type' => 'system',
37         'callback' => 'system_send_email_action',
38         'parameters' => 'a:3:{s:9:"recipient";s:7:"%author";s:7:"subject";s:4:"Test";s:7:"message";s:4:"Test',
39         'description' => 'Test notice email',
40       ],
41       [
42         'aid' => 'comment_publish_action',
43         'type' => 'comment',
44         'callback' => 'comment_publish_action',
45         'parameters' => NULL,
46         'description' => NULL,
47       ],
48       [
49         'aid' => 'node_publish_action',
50         'type' => 'comment',
51         'callback' => 'node_publish_action',
52         'parameters' => NULL,
53         'description' => NULL,
54       ],
55     ];
56     // The expected results are identical to the source data.
57     $tests[0][1] = $tests[0][0]['actions'];
58
59     return $tests;
60   }
61
62 }