tests/Encoder/EncoderTest.php
/**
     * Test encode with relationship related Link.
     */
Test encode with relationship related Link.
Test encode with relationship related Link .
public function testEncodeWithRelationshipRelatedLink(): void
    {
        $post   = $this->getStandardPost();
        $actual = Encoder::instance(
            [
                Post::class => PostSchema::class,
            ]
        )->withRelationshipRelatedLink($post, Post::LINK_AUTHOR)->encodeData([]);
        $expected = <<<EOL
        {
            "links": {
                "related": "/posts/1/author"
            },
            "data" : []
        }
EOL;
        self::assertJsonStringEqualsJsonString($expected, $actual);
    }
public function testEncodeWithRelationshipRelatedLink ( ) : void { $ post = $ this -> getStandardPost ( ) ; $ actual = Encoder :: instance ( [ Post :: class => PostSchema :: class , ] ) -> withRelationshipRelatedLink ( $ post , Post :: LINK_AUTHOR ) -> encodeData ( [ ] ) ; $ expected = <<< EOL         {             "links": {                 "related": "/posts/1/author"             },             "data" : []         } 
EOL ; self :: assertJsonStringEqualsJsonString ( $ expected , $ actual ) ; }
Test encode with relationship related Link.
Test encode with relationship related Link .