You are here

public function SimplesitemapTest::testNewEntityWithIdSet 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::testNewEntityWithIdSet()

Tests that a page does not break if an entity has its id set.

File

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

Class

SimplesitemapTest
Tests Simple XML Sitemap functional integration.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

public function testNewEntityWithIdSet() {
  $new_node = Node::create([
    'nid' => random_int(5, 10),
    'type' => 'page',
  ]);

  // Assert that the form does not break if an entity has an id but is not
  // saved.
  // @see https://www.drupal.org/project/simple_sitemap/issues/3079897
  \Drupal::service('entity.form_builder')
    ->getForm($new_node);
}