comparison 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
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
169 169
170 $this->assertFalse($loaded_node->get('path')->isEmpty()); 170 $this->assertFalse($loaded_node->get('path')->isEmpty());
171 $this->assertEquals('/foobar', $loaded_node->get('path')->alias); 171 $this->assertEquals('/foobar', $loaded_node->get('path')->alias);
172 $stored_alias = $alias_storage->lookupPathAlias('/' . $node->toUrl()->getInternalPath(), $node->language()->getId()); 172 $stored_alias = $alias_storage->lookupPathAlias('/' . $node->toUrl()->getInternalPath(), $node->language()->getId());
173 $this->assertEquals('/foobar', $stored_alias); 173 $this->assertEquals('/foobar', $stored_alias);
174
175 // Check that \Drupal\Core\Field\FieldItemList::equals() for the path field
176 // type.
177 $node = Node::create([
178 'title' => $this->randomString(),
179 'type' => 'foo',
180 'path' => ['alias' => '/foo'],
181 ]);
182 $second_node = Node::create([
183 'title' => $this->randomString(),
184 'type' => 'foo',
185 'path' => ['alias' => '/foo'],
186 ]);
187 $this->assertTrue($node->get('path')->equals($second_node->get('path')));
188
189 // Change the alias for the second node to a different one and try again.
190 $second_node->get('path')->alias = '/foobar';
191 $this->assertFalse($node->get('path')->equals($second_node->get('path')));
174 } 192 }
175 193
176 } 194 }