You are here

public function MetatagNoIndexTest::testDefaultsNoIndex in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/MetatagNoIndexTest.php \Drupal\Tests\xmlsitemap\Kernel\MetatagNoIndexTest::testDefaultsNoIndex()

Tests that default robots metatags are ignored.

File

tests/src/Kernel/MetatagNoIndexTest.php, line 114

Class

MetatagNoIndexTest
Tests integration with the Metatag module.

Namespace

Drupal\Tests\xmlsitemap\Kernel

Code

public function testDefaultsNoIndex() {

  // Set the user entity default robots metatag to noindex.
  $config = $this
    ->config('metatag.metatag_defaults.user');
  $config
    ->set('tags.robots', 'noindex');
  $config
    ->save();

  // Test that this hasn't changed the link availability.
  $this->account
    ->save();
  $link = $this->linkStorage
    ->load('user', $this->account
    ->id());
  $this
    ->assertTrue($link['access'] && $link['status']);
}