tests/Extensions/Issue82/IssueTest.php
/**
     * Test very basic sample to be used in project description.
     */
Test very basic sample to be used in project description.
Test very basic sample to be used in project description .
public function testEnheritedEncoder(): void
    {
        $author  = Author::instance(123, 'John', 'Doe');
        $encoder = Encoder::instance([
                Author::class => AuthorSchema::class,
            ])
            ->withUrlPrefix('http://example.com/api/v1')
            ->withEncodeOptions(JSON_PRETTY_PRINT);
        $actual = $encoder->encodeData($author);
        $expected = <<<EOL
        {
            "data" : {
                "type"       : "people",
                "id"         : "123",
                "attributes" : {
                    "first-name": "John",
                    "last-name": "Doe"
                },
                "relationships" : {
                    "comments" : {
                        "links": {
                            "related" : "http://example.com/api/v1/people/123/comments"
                        }
                    }
                },
                "links" : {
                    "self" : "http://example.com/api/v1/people/123"
                }
            }
        }
EOL;
        self::assertJsonStringEqualsJsonString($expected, $actual);
    }
public function testEnheritedEncoder ( ) : void { $ author = Author :: instance ( 123 , 'John' , 'Doe' ) ; $ encoder = Encoder :: instance ( [ Author :: class => AuthorSchema :: class , ] ) -> withUrlPrefix ( 'http://example.com/api/v1' ) -> withEncodeOptions ( JSON_PRETTY_PRINT ) ; $ actual = $ encoder -> encodeData ( $ author ) ; $ expected = <<< EOL         {             "data" : {                 "type"       : "people",                 "id"         : "123",                 "attributes" : {                     "first-name": "John",                     "last-name": "Doe"                 },                 "relationships" : {                     "comments" : {                         "links": {                             "related" : "http://example.com/api/v1/people/123/comments"                         }                     }                 },                 "links" : {                     "self" : "http://example.com/api/v1/people/123"                 }             }         } 
EOL ; self :: assertJsonStringEqualsJsonString ( $ expected , $ actual ) ; }
Test very basic sample to be used in project description.
Test very basic sample to be used in project description .