tests/Encoder/EncodeSimpleObjectsTest.php
/**
     * Test encode array of simple objects as resource identity.
     */
Test encode array of simple objects as resource identity.
Test encode array of simple objects as resource identity .
public function testEncodeArrayAsResourceIdentity(): void
    {
        $author  = Author::instance(9, 'Dan', 'Gebhardt');
        $encoder = Encoder::instance(
            [
                Author::class => AuthorSchema::class,
            ]
        )->withUrlPrefix('http://example.com');
        $actual = $encoder->encodeIdentifiers([$author]);
        $expected = <<<EOL
        {
            "data" : [{
                "type" : "people",
                "id"   : "9"
            }]
        }
EOL;
        self::assertJsonStringEqualsJsonString($expected, $actual);
    }
public function testEncodeArrayAsResourceIdentity ( ) : void { $ author = Author :: instance ( 9 , 'Dan' , 'Gebhardt' ) ; $ encoder = Encoder :: instance ( [ Author :: class => AuthorSchema :: class , ] ) -> withUrlPrefix ( 'http://example.com' ) ; $ actual = $ encoder -> encodeIdentifiers ( [ $ author ] ) ; $ expected = <<< EOL         {             "data" : [{                 "type" : "people",                 "id"   : "9"             }]         } 
EOL ; self :: assertJsonStringEqualsJsonString ( $ expected , $ actual ) ; }
Test encode array of simple objects as resource identity.
Test encode array of simple objects as resource identity .