tests/Encoder/EncoderTest.php
/**
     * Test encode unrecognized resource (no registered Schema).
     */
Test encode unrecognized resource (no registered Schema).
Test encode unrecognized resource ( no registered Schema ) .
public function testEncodeUnrecognizedResourceAtRoot(): void
    {
        $author = Author::instance(9, 'Dan', 'Gebhardt');
        $catch = null;
        try {
            Encoder::instance(
                [
                    Post::class => PostSchema::class,
                ]
            )->withUrlPrefix('http://example.com')->encodeData($author);
        } catch (InvalidArgumentException $exception) {
            $catch = $exception;
        }
        self::assertNotNull($catch);
        self::assertStringContainsString('top-level', $catch->getMessage());
    }
public function testEncodeUnrecognizedResourceAtRoot ( ) : void { $ author = Author :: instance ( 9 , 'Dan' , 'Gebhardt' ) ; $ catch = null ; try { Encoder :: instance ( [ Post :: class => PostSchema :: class , ] ) -> withUrlPrefix ( 'http://example.com' ) -> encodeData ( $ author ) ; } catch ( InvalidArgumentException $ exception ) { $ catch = $ exception ; } self :: assertNotNull ( $ catch ) ; self :: assertStringContainsString ( 'top-level' , $ catch -> getMessage ( ) ) ; }
Test encode unrecognized resource (no registered Schema).
Test encode unrecognized resource ( no registered Schema ) .
/** @var InvalidArgumentException $catch */