You are here

public function SimplesitemapTest::testEnableEntityType in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testEnableEntityType()
  2. 8.2 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testEnableEntityType()

Test enabling sitemap support for an entity type.

@todo Test admin/config/search/simplesitemap/entities form.

Throws

\Drupal\Component\Plugin\Exception\PluginException

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/SimplesitemapTest.php, line 535

Class

SimplesitemapTest
Tests Simple XML Sitemap functional integration.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

public function testEnableEntityType() {
  $this->generator
    ->entityManager()
    ->disableEntityType('node')
    ->enableEntityType('node')
    ->setBundleSettings('node', 'page');
  $this
    ->drupalLogin($this->privilegedUser);
  $this
    ->drupalGet('admin/structure/types/manage/page');
  $this
    ->assertSession()
    ->pageTextContains('Simple XML Sitemap');
  $this->generator
    ->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
  $this
    ->drupalGet($this->defaultSitemapUrl);
  $this
    ->assertSession()
    ->responseContains('node/' . $this->node
    ->id());
  $this
    ->assertTrue($this->generator
    ->entityManager()
    ->entityTypeIsEnabled('node'));
}