Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / pathauto / tests / src / Kernel / PathautoKernelTest.php
index b69d4373c956f602c92fa9aa353908f7b4b6a91e..1d5db68b2f505df7d5ba67b62310f79b70a7658b 100644 (file)
@@ -547,6 +547,22 @@ class PathautoKernelTest extends KernelTestBase {
     $this->assertEntityAlias($node1, '/content/default-revision');
   }
 
+  /**
+   * Tests that the pathauto state property gets set to CREATED for new nodes.
+   *
+   * In some cases, this can trigger $node->path to be set up with no default
+   * value for the pathauto property.
+   */
+  public function testCreateNodeWhileAccessingPath() {
+    $node = Node::create([
+      'type' => 'article',
+      'title' => 'TestAlias',
+    ]);
+    $node->path->langcode;
+    $node->save();
+    $this->assertEntityAlias($node, '/content/testalias');
+  }
+
   /**
    * Creates a node programmatically.
    *