You are here

public function XmlSitemapEntityFunctionalTest::testEntitiesSettingsForms in XML sitemap 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/XmlSitemapEntityFunctionalTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapEntityFunctionalTest::testEntitiesSettingsForms()

Test the form at admin/config/search/xmlsitemap/entities/settings.

File

tests/src/Functional/XmlSitemapEntityFunctionalTest.php, line 38

Class

XmlSitemapEntityFunctionalTest
Tests the generation of a random content entity links.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

public function testEntitiesSettingsForms() {
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('admin/config/search/xmlsitemap/entities/settings');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->fieldExists('entity_types[entity_test_mul]');
  $this
    ->assertSession()
    ->fieldExists('settings[entity_test_mul][types][entity_test_mul]');
  $edit = [
    'entity_types[entity_test_mul]' => 1,
    'settings[entity_test_mul][types][entity_test_mul]' => 1,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('The configuration options have been saved.');
  $entity = EntityTestMul::create();
  $entity
    ->save();
  $this
    ->assertSitemapLinkValues('entity_test_mul', $entity
    ->id(), [
    'status' => 0,
    'priority' => 0.5,
    'changefreq' => 0,
    'access' => 1,
  ]);
}