Commit 01cfb78d authored by amateescu's avatar amateescu
Browse files

Fix the robotstxt integration test.

parent 596fcebf
......@@ -21,14 +21,20 @@ class XmlSitemapRobotsTxtIntegrationTest extends XmlSitemapTestBase {
* Test if sitemap link is included in robots.txt file.
*/
public function testRobotsTxt() {
// Request the un-clean robots.txt path so this will work in case there is
// still the robots.txt file in the root directory.
// Move the robots.txt file shipped by core out of the way for the duration
// of this test.
$new_path = FALSE;
if (file_exists(DRUPAL_ROOT . '/robots.txt')) {
$this->error(t('Unable to proceed with configured robots.txt tests: A local file already exists at @s, so the menu override in this module will never run.', array('@s' => DRUPAL_ROOT . '/robots.txt')));
return;
$new_path = file_unmanaged_move(DRUPAL_ROOT . '/robots.txt', DRUPAL_ROOT . '/robots.txt.tmp');
}
$this->drupalGet('/robots.txt');
$this->drupalGet('robots.txt');
$this->assertRaw('Sitemap: ' . Url::fromRoute('xmlsitemap.sitemap_xml', [], ['absolute' => TRUE])->toString());
// Put back the original robots.txt file.
if ($new_path) {
file_unmanaged_move($new_path, DRUPAL_ROOT . '/robots.txt');
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment