Security update for Core, with self-updated composer
[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   ];
24
25   /**
26    * {@inheritdoc}
27    */
28   protected function setUp() {
29     parent::setUp();
30
31     $this->installEntitySchema('node');
32     $this->installConfig(['node']);
33     $this->installSchema('node', ['node_access']);
34     $this->installSchema('system', ['key_value']);
35     $this->migrateUsers(FALSE);
36     $this->migrateFields();
37
38     $this->executeMigrations([
39       'language',
40       'd6_language_types',
41       'd6_language_negotiation_settings',
42       'd6_node_settings',
43       'd6_node',
44       'd6_node_translation',
45     ]);
46   }
47
48   /**
49    * Tests that not found node translations are redirected.
50    */
51   public function testNodeTranslationRedirect() {
52     $kernel = $this->container->get('http_kernel');
53     $request = Request::create('/node/11');
54     $response = $kernel->handle($request);
55     $this->assertSame(301, $response->getStatusCode());
56     $this->assertSame('/node/10', $response->getTargetUrl());
57   }
58
59 }