NodeTranslationRedirectTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php
- 9 core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php
- 8.9.x core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php
- 8.9.x core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php
- 11.x core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php
- 11.x core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php
Namespace
Drupal\Tests\node\Kernel\Migrate\d6File
-
core/
modules/ node/ tests/ src/ Kernel/ Migrate/ d6/ NodeTranslationRedirectTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\node\Kernel\Migrate\d6;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Symfony\Component\HttpFoundation\Request;
/**
* Tests node translation redirects.
*
* @group migrate_drupal
* @group node
*/
class NodeTranslationRedirectTest extends MigrateDrupal6TestBase {
use UserCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'content_translation',
'language',
'menu_ui',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->setUpCurrentUser();
$this->installEntitySchema('node');
$this->installConfig([
'node',
]);
$this->installSchema('node', [
'node_access',
]);
$this->migrateUsers(FALSE);
$this->migrateFields();
$this->executeMigrations([
'language',
'd6_language_types',
'd6_language_negotiation_settings',
'd6_node_settings',
'd6_node',
'd6_node_translation',
]);
}
/**
* Tests that not found node translations are redirected.
*/
public function testNodeTranslationRedirect() : void {
$kernel = $this->container
->get('http_kernel');
$request = Request::create('/node/11');
$response = $kernel->handle($request);
$this->assertSame(301, $response->getStatusCode());
$this->assertSame('/node/10', $response->getTargetUrl());
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
NodeTranslationRedirectTest | Tests node translation redirects. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.