function NodeTranslationRedirectTest::testNodeTranslationRedirect

Same name in this branch
  1. 10 core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d7\NodeTranslationRedirectTest::testNodeTranslationRedirect()
Same name in other branches
  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()
  3. 8.9.x core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d6\NodeTranslationRedirectTest::testNodeTranslationRedirect()
  4. 8.9.x core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d7\NodeTranslationRedirectTest::testNodeTranslationRedirect()
  5. 11.x core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php \Drupal\Tests\node\Kernel\Migrate\d6\NodeTranslationRedirectTest::testNodeTranslationRedirect()
  6. 11.x 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/d6/NodeTranslationRedirectTest.php, line 57

Class

NodeTranslationRedirectTest
Tests node translation redirects.

Namespace

Drupal\Tests\node\Kernel\Migrate\d6

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.