diff core/modules/path/tests/src/Kernel/PathItemTest.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 1fec387a4317
line wrap: on
line diff
--- a/core/modules/path/tests/src/Kernel/PathItemTest.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/core/modules/path/tests/src/Kernel/PathItemTest.php	Fri Feb 23 15:52:07 2018 +0000
@@ -171,6 +171,24 @@
     $this->assertEquals('/foobar', $loaded_node->get('path')->alias);
     $stored_alias = $alias_storage->lookupPathAlias('/' . $node->toUrl()->getInternalPath(), $node->language()->getId());
     $this->assertEquals('/foobar', $stored_alias);
+
+    // Check that \Drupal\Core\Field\FieldItemList::equals() for the path field
+    // type.
+    $node = Node::create([
+      'title' => $this->randomString(),
+      'type' => 'foo',
+      'path' => ['alias' => '/foo'],
+    ]);
+    $second_node = Node::create([
+      'title' => $this->randomString(),
+      'type' => 'foo',
+      'path' => ['alias' => '/foo'],
+    ]);
+    $this->assertTrue($node->get('path')->equals($second_node->get('path')));
+
+    // 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')));
   }
 
 }