Version 1
[yaffs-website] / web / modules / contrib / redirect / tests / src / Unit / Migrate / d7 / PathRedirectTest.php
1 <?php
2
3 namespace Drupal\Tests\redirect\Unit\Migrate\d7;
4
5 use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
6
7 /**
8  * Tests D7 redirect source plugin.
9  *
10  * @group redirect
11  */
12 class PathRedirectTest extends MigrateSqlSourceTestCase {
13
14   const PLUGIN_CLASS = 'Drupal\redirect\Plugin\migrate\source\d7\PathRedirect';
15
16   protected $migrationConfiguration = [
17     'id' => 'test',
18     'source' => [
19       'plugin' => 'd7_path_redirect',
20     ],
21   ];
22
23   protected $expectedResults = [
24     [
25       'rid' => 5,
26       'hash' => 'MwmDbnA65ag646gtEdLqmAqTbF0qQerse63RkQmJK_Y',
27       'type' => 'redirect',
28       'uid' => 5,
29       'source' => 'test/source/url',
30       'source_options' => '',
31       'redirect' => 'test/redirect/url',
32       'redirect_options' => '',
33       'language' => 'und',
34       'status_code' => 301,
35       'count' => 2518,
36       'access' => 1449497138,
37     ],
38   ];
39
40   /**
41    * {@inheritdoc}
42    */
43   protected function setUp() {
44     $this->databaseContents['variable'] = [
45       [
46         'name' => 'redirect_default_status_code',
47         'value' => 's:3:"307";',
48       ]
49     ];
50     $this->databaseContents['redirect'] = $this->expectedResults;
51     parent::setUp();
52   }
53
54 }