public function PathFieldSerializerTest::testPathFieldSerialization in Acquia Content Hub 8.2
Tests the serialization of the path field.
Throws
\Drupal\Core\Entity\EntityStorageException
File
- tests/
src/ Kernel/ EventSubscriber/ SerializeContentField/ PathFieldSerializerTest.php, line 64
Class
- PathFieldSerializerTest
- Tests Path Field Serialization.
Namespace
Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\SerializeContentFieldCode
public function testPathFieldSerialization() {
$node = $this
->createNode();
$this->entity = PathAlias::create([
'path' => '/node/' . $node
->id(),
'alias' => 'new_test_path',
]);
$this->entity
->save();
$field = $this->entity
->get(self::FIELD_NAME);
$event = $this
->dispatchSerializeEvent(self::FIELD_NAME, $field);
$actual_output = $event
->getFieldData()['value'][Language::LANGCODE_NOT_SPECIFIED]['value'];
// Check expected output after path field serialization.
$this
->assertEquals($node
->uuid(), $actual_output);
}