You are here

public function PathFieldSerializerTest::testNodePathFieldSerialization in Acquia Content Hub 8.2

Tests the serialization of the node path field.

Throws

\Drupal\Core\Entity\EntityStorageException

File

tests/src/Kernel/EventSubscriber/SerializeContentField/PathFieldSerializerTest.php, line 87

Class

PathFieldSerializerTest
Tests Path Field Serialization.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\SerializeContentField

Code

public function testNodePathFieldSerialization() {
  $this->entity = $this
    ->createNode();
  $field = $this->entity
    ->get(self::FIELD_NAME);
  PathAlias::create([
    'path' => '/node/' . $this->entity
      ->id(),
    'alias' => 'new_test_path',
  ]);
  $event = $this
    ->dispatchSerializeEvent(self::FIELD_NAME, $field);
  $this
    ->assertTrue($event
    ->isPropagationStopped());
}