Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / node / tests / src / Kernel / Migrate / d6 / NodeTranslationRedirectTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Kernel\Migrate\d6;
4
5 use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
6 use Symfony\Component\HttpFoundation\Request;
7
8 /**
9  * Tests node translation redirections.
10  *
11  * @group migrate_drupal
12  * @group node
13  */
14 class NodeTranslationRedirectTest extends MigrateDrupal6TestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = [
20     'content_translation',
21     'language',
22     'menu_ui',
23     // Required for translation migrations.
24     'migrate_drupal_multilingual',
25   ];
26
27   /**
28    * {@inheritdoc}
29    */
30   protected function setUp() {
31     parent::setUp();
32
33     $this->installEntitySchema('node');
34     $this->installConfig(['node']);
35     $this->installSchema('node', ['node_access']);
36     $this->installSchema('system', ['key_value']);
37     $this->migrateUsers(FALSE);
38     $this->migrateFields();
39
40     $this->executeMigrations([
41       'language',
42       'd6_language_types',
43       'd6_language_negotiation_settings',
44       'd6_node_settings',
45       'd6_node',
46       'd6_node_translation',
47     ]);
48   }
49
50   /**
51    * Tests that not found node translations are redirected.
52    */
53   public function testNodeTranslationRedirect() {
54     $kernel = $this->container->get('http_kernel');
55     $request = Request::create('/node/11');
56     $response = $kernel->handle($request);
57     $this->assertSame(301, $response->getStatusCode());
58     $this->assertSame('/node/10', $response->getTargetUrl());
59   }
60
61 }