You are here

public function RobotsTxtBasicTestCase::testRobotsTxtPath in RobotsTxt 7

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

File

./robotstxt.test, line 65
Tests for robotstxt.module.

Class

RobotsTxtBasicTestCase
Tests basic functionality of configured robots.txt files.

Code

public function testRobotsTxtPath() {
  $this
    ->drupalGet('robots-test.txt');
  $this
    ->assertResponse(200, 'An anonymous user is delivered content at the /robots.txt path.');
  $this
    ->assertText('# This file is to prevent the crawling and indexing of certain parts');

  // Note: the header may have charset appended.
  $header = $this
    ->drupalGetHeader('Content-Type');
  $this
    ->assertIdentical(strpos($header, 'text/plain'), 0, 'The robots.txt file was served with header Content-Type: text/plain');
}