You are here

public function NodeTranslationRedirectTest::testNodeTranslationRedirect in Drupal 9

Same name in this branch
  1. 9 core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d6\NodeTranslationRedirectTest::testNodeTranslationRedirect()
  2. 9 core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d7\NodeTranslationRedirectTest::testNodeTranslationRedirect()
Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d7\NodeTranslationRedirectTest::testNodeTranslationRedirect()
  2. 10 core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d7\NodeTranslationRedirectTest::testNodeTranslationRedirect()

Tests that not found node translations are redirected.

File

core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php, line 55

Class

NodeTranslationRedirectTest
Tests node translation redirections.

Namespace

Drupal\Tests\node\Kernel\Migrate\d7

Code

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());
}