You are here

public function RobotsTxtBasicTest::testRobotsTxtPath in RobotsTxt 8

Test that the robots.txt path delivers content with an appropriate header.

File

tests/src/Functional/RobotsTxtBasicTest.php, line 77

Class

RobotsTxtBasicTest
Tests basic functionality of configured robots.txt files.

Namespace

Drupal\Tests\robotstxt\Functional

Code

public function testRobotsTxtPath() {
  $this
    ->drupalGet('robots-test.txt');

  // No local robots.txt file was detected, and an anonymous user is delivered
  // content at the /robots.txt path.
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // The robots.txt file was served with header
  // Content-Type: "text/plain; charset=UTF-8".
  $this
    ->assertSession()
    ->responseHeaderEquals('Content-Type', 'text/plain; charset=UTF-8');
}