3 namespace Drupal\Tests\node\Kernel\Migrate\d7;
5 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
6 use Symfony\Component\HttpFoundation\Request;
9 * Tests node translation redirections.
11 * @group migrate_drupal
14 class NodeTranslationRedirectTest extends MigrateDrupal7TestBase {
19 public static $modules = [
20 'content_translation',
23 // Required for translation migrations.
24 'migrate_drupal_multilingual',
32 protected function setUp() {
35 $this->installEntitySchema('node');
36 $this->installConfig('node');
37 $this->installSchema('node', ['node_access']);
38 $this->installSchema('system', ['key_value']);
40 $this->executeMigrations([
43 'd7_language_negotiation_settings',
48 'd7_node_translation',
53 * Tests that not found node translations are redirected.
55 public function testNodeTranslationRedirect() {
56 $kernel = $this->container->get('http_kernel');
57 $request = Request::create('/node/3');
58 $response = $kernel->handle($request);
59 $this->assertSame(301, $response->getStatusCode());
60 $this->assertSame('/node/2', $response->getTargetUrl());