tests/Extensions/Issue169/IssueTest.php
/**
     * Test encoder will serialize into arrays.
     *
     * @see https://github.com/neomerx/json-api/issues/169
     */
Test encoder will serialize into arrays.
Test encoder will serialize into arrays .
public function testIdentifiersSerialization(): void
    {
        $author = Author::instance(9, 'Dan', 'Gebhardt');
        $encoder = CustomEncoder::instance(
            [
                Author::class => AuthorSchema::class,
            ]
        );
        $actual = $encoder->serializeIdentifiers($author);
        $expected = [
            'data' => [
                'type' => 'people',
                'id'   => '9',
            ],
        ];
        $this->assertEquals($expected, $actual);
    }
public function testIdentifiersSerialization ( ) : void { $ author = Author :: instance ( 9 , 'Dan' , 'Gebhardt' ) ; $ encoder = CustomEncoder :: instance ( [ Author :: class => AuthorSchema :: class , ] ) ; $ actual = $ encoder -> serializeIdentifiers ( $ author ) ; $ expected = [ 'data' => [ 'type' => 'people' , 'id' => '9' , ] , ] ; $ this -> assertEquals ( $ expected , $ actual ) ; }
Test encoder will serialize into arrays.
Test encoder will serialize into arrays .
/** @var CustomEncoder $encoder */