NodeTranslationRedirectTest.php in Drupal 8
File
core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php
View source
<?php
namespace Drupal\Tests\node\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Symfony\Component\HttpFoundation\Request;
class NodeTranslationRedirectTest extends MigrateDrupal7TestBase {
use UserCreationTrait;
public static $modules = [
'content_translation',
'language',
'menu_ui',
'node',
'text',
'user',
];
protected function setUp() {
parent::setUp();
$this
->setUpCurrentUser();
$this
->installSchema('node', [
'node_access',
]);
$this
->installSchema('system', [
'key_value',
]);
$this
->migrateUsers(FALSE);
$this
->migrateContentTypes();
$this
->executeMigrations([
'language',
'd7_language_types',
'd7_language_negotiation_settings',
'd7_node',
'd7_node_translation',
]);
}
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());
}
}