diff core/modules/path/tests/src/Kernel/PathItemTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 7a779792577d
children
line wrap: on
line diff
--- a/core/modules/path/tests/src/Kernel/PathItemTest.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/modules/path/tests/src/Kernel/PathItemTest.php	Mon Apr 23 09:46:53 2018 +0100
@@ -189,6 +189,18 @@
     // 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);
   }
 
 }