1414namespace ApiPlatform \Tests \Functional ;
1515
1616use ApiPlatform \Symfony \Bundle \Test \ApiTestCase ;
17+ use ApiPlatform \Tests \Fixtures \TestBundle \ApiResource \Issue6810 \JsonLdContextOutput ;
1718use ApiPlatform \Tests \Fixtures \TestBundle \Entity \Issue6465 \Bar ;
1819use ApiPlatform \Tests \Fixtures \TestBundle \Entity \Issue6465 \Foo ;
1920use ApiPlatform \Tests \SetupClassResourcesTrait ;
@@ -29,7 +30,7 @@ class JsonLdTest extends ApiTestCase
2930 */
3031 public static function getResources (): array
3132 {
32- return [Foo::class, Bar::class];
33+ return [Foo::class, Bar::class, JsonLdContextOutput::class ];
3334 }
3435
3536 /**
@@ -50,6 +51,20 @@ public function testIssue6465(): void
5051 $ this ->assertEquals ('Bar two ' , $ res ['title ' ]);
5152 }
5253
54+ public function testContextWithOutput (): void
55+ {
56+ $ response = self ::createClient ()->request (
57+ 'GET ' ,
58+ '/json_ld_context_output ' ,
59+ );
60+ $ res = $ response ->toArray ();
61+ $ this ->assertEquals ($ res ['@context ' ], [
62+ '@vocab ' => 'http://localhost/docs.jsonld# ' ,
63+ 'hydra ' => 'http://www.w3.org/ns/hydra/core# ' ,
64+ 'foo ' => 'Output/foo ' ,
65+ ]);
66+ }
67+
5368 protected function setUp (): void
5469 {
5570 self ::bootKernel ();
@@ -66,8 +81,12 @@ protected function setUp(): void
6681 $ classes [] = $ manager ->getClassMetadata ($ entityClass );
6782 }
6883
69- $ schemaTool = new SchemaTool ($ manager );
70- @$ schemaTool ->createSchema ($ classes );
84+ try {
85+ $ schemaTool = new SchemaTool ($ manager );
86+ @$ schemaTool ->createSchema ($ classes );
87+ } catch (\Exception $ e ) {
88+ return ;
89+ }
7190
7291 $ foo = new Foo ();
7392 $ foo ->title = 'Foo ' ;
0 commit comments