assertSame(MediaRelation::ITEM_TYPE, $mediaRelation->getType()); $this->assertSame('uri-string', $mediaRelation->getId()); $this->assertSame('label', $mediaRelation->getLabel()); $this->assertFalse($mediaRelation->isMedia()); } public function testConstructWithDefaultLabel() { $mediaRelation = new MediaRelation(MediaRelation::MEDIA_TYPE, '24'); $this->assertSame(MediaRelation::MEDIA_TYPE, $mediaRelation->getType()); $this->assertSame('24', $mediaRelation->getId()); $this->assertNull($mediaRelation->getLabel()); $this->assertTrue($mediaRelation->isMedia()); } public function testJsonSerialized() { $mediaRelation = new MediaRelation(MediaRelation::MEDIA_TYPE, '1', 'label'); $this->assertInstanceOf(JsonSerializable::class, $mediaRelation); $expected = json_encode([ 'type' => MediaRelation::MEDIA_TYPE, 'id' => '1', 'label' => 'label', ]); $this->assertSame($expected, json_encode($mediaRelation)); } }