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