Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / path / tests / src / Kernel / PathItemTest.php
index d7627c3690c8646ea8b5a55542de5f59b0db12c5..224a8420b3b165a32500f119d7af9f06f988ca20 100644 (file)
@@ -189,6 +189,18 @@ class PathItemTest extends KernelTestBase {
     // Change the alias for the second node to a different one and try again.
     $second_node->get('path')->alias = '/foobar';
     $this->assertFalse($node->get('path')->equals($second_node->get('path')));
+
+    // Test the generateSampleValue() method.
+    $node = Node::create([
+      'title' => $this->randomString(),
+      'type' => 'foo',
+      'path' => ['alias' => '/foo'],
+    ]);
+    $node->save();
+    $path_field = $node->get('path');
+    $path_field->generateSampleItems();
+    $node->save();
+    $this->assertStringStartsWith('/', $node->get('path')->alias);
   }
 
 }