Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
<?php
namespace Drupal\Tests\node\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests node translation redirections.
*
* @group migrate_drupal
* @group node
*/
class NodeTranslationRedirectTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'content_translation',
'language',
'menu_ui',
'node',
'text',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installEntitySchema('node');
$this->installConfig('node');
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['key_value']);
$this->executeMigrations([
'language',
'd7_language_types',
'd7_language_negotiation_settings',
'd7_user_role',
'd7_user',
'd7_node_type',
'd7_node',
'd7_node_translation',
]);
}
/**
* Tests that not found node translations are redirected.
*/
public function testNodeTranslationRedirect() {
$kernel = $this->container->get('http_kernel');
$request = Request::create('/node/3');
$response = $kernel->handle($request);
$this->assertSame(301, $response->getStatusCode());
$this->assertSame('/node/2', $response->getTargetUrl());
}
}