/** * @covers ::normalize */ public function testNormalizeWithNoEntity() { $entity_reference = $this->prophesize(TypedDataInterface::class); $entity_reference->getValue()->willReturn(NULL)->shouldBeCalled(); $this->fieldItem->get('entity')->willReturn($entity_reference->reveal())->shouldBeCalled(); $normalized = $this->normalizer->normalize($this->fieldItem->reveal()); $expected = ['target_id' => ['value' => 'test']]; $this->assertSame($expected, $normalized); }