• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 18089937549

29 Sep 2025 07:56AM UTC coverage: 21.764% (-0.3%) from 22.093%
18089937549

Pull #7416

github

web-flow
Merge 061bcc790 into abe0438be
Pull Request #7416: fix(laravel): serializer attributes on Eloquent methods

0 of 151 new or added lines in 11 files covered. (0.0%)

5028 existing lines in 173 files now uncovered.

11889 of 54626 relevant lines covered (21.76%)

25.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Hydra/Tests/Serializer/DocumentationNormalizerTest.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Hydra\Tests\Serializer;
15

16
use ApiPlatform\Documentation\Documentation;
17
use ApiPlatform\Hydra\Serializer\DocumentationNormalizer;
18
use ApiPlatform\Hydra\Tests\Fixtures\CustomConverter;
19
use ApiPlatform\JsonLd\ContextBuilder;
20
use ApiPlatform\Metadata\ApiProperty;
21
use ApiPlatform\Metadata\ApiResource;
22
use ApiPlatform\Metadata\Get;
23
use ApiPlatform\Metadata\GetCollection;
24
use ApiPlatform\Metadata\Operations;
25
use ApiPlatform\Metadata\Post;
26
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
27
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
28
use ApiPlatform\Metadata\Property\PropertyNameCollection;
29
use ApiPlatform\Metadata\Put;
30
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
31
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
32
use ApiPlatform\Metadata\Resource\ResourceNameCollection;
33
use ApiPlatform\Metadata\ResourceClassResolverInterface;
34
use ApiPlatform\Metadata\UrlGeneratorInterface;
35
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
36
use PHPUnit\Framework\TestCase;
37
use Prophecy\Argument;
38
use Prophecy\PhpUnit\ProphecyTrait;
39
use Symfony\Component\TypeInfo\Type;
40

41
use const ApiPlatform\JsonLd\HYDRA_CONTEXT;
42

43
/**
44
 * @author Amrouche Hamza <hamza.simperfit@gmail.com>
45
 */
46
class DocumentationNormalizerTest extends TestCase
47
{
48
    use ProphecyTrait;
49

50
    #[IgnoreDeprecations]
51
    public function testNormalize(): void
52
    {
53
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
×
54
        $resourceMetadataFactoryProphecy->create('dummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('dummy', [
×
55
            (new ApiResource())->withShortName('dummy')->withDescription('dummy')->withTypes(['#dummy'])->withOperations(new Operations([
×
56
                'get' => (new Get())->withHydraContext(['hydra:foo' => 'bar', 'hydra:title' => 'foobar'])->withTypes(['#dummy'])->withShortName('dummy'),
×
57
                'put' => (new Put())->withShortName('dummy'),
×
58
                'get_collection' => (new GetCollection())->withShortName('dummy'),
×
59
                'post' => (new Post())->withShortName('dummy'),
×
60
            ])),
×
61
            (new ApiResource())->withShortName('relatedDummy')->withOperations(new Operations(['get' => (new Get())->withTypes(['#relatedDummy'])->withShortName('relatedDummy')])),
×
62
        ]));
×
63
        $resourceMetadataFactoryProphecy->create('relatedDummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('relatedDummy', [
×
UNCOV
64
            (new ApiResource())->withShortName('relatedDummy')->withOperations(new Operations(['get' => (new Get())->withShortName('relatedDummy')])),
×
65
        ]));
×
66

UNCOV
67
        $this->doTestNormalize($resourceMetadataFactoryProphecy->reveal());
×
68
    }
69

70
    private function doTestNormalize($resourceMetadataFactory = null): void
71
    {
72
        $title = 'Test Api';
×
73
        $desc = 'test ApiGerard';
×
UNCOV
74
        $version = '0.0.0';
×
75
        $documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']), $title, $desc, $version);
×
76

UNCOV
77
        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
×
78
        $propertyNameCollectionFactoryProphecy->create('dummy', [])->shouldBeCalled()->willReturn(new PropertyNameCollection(['name', 'description', 'nameConverted', 'relatedDummy', 'iri']));
×
79

80
        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
×
81
        $propertyMetadataFactoryProphecy->create('dummy', 'name', Argument::type('array'))->shouldBeCalled()->willReturn(
×
82
            (new ApiProperty())->withNativeType(Type::string())->withDescription('name')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)
×
83
        );
×
84
        $propertyMetadataFactoryProphecy->create('dummy', 'description', Argument::type('array'))->shouldBeCalled()->willReturn(
×
85
            (new ApiProperty())->withNativeType(Type::string())->withDescription('description')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)->withJsonldContext(['@type' => '@id'])
×
86
        );
×
87
        $propertyMetadataFactoryProphecy->create('dummy', 'nameConverted', Argument::type('array'))->shouldBeCalled()->willReturn(
×
88
            (new ApiProperty())->withNativeType(Type::string())->withDescription('name converted')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)
×
89
        );
×
UNCOV
90
        $propertyMetadataFactoryProphecy->create('dummy', 'relatedDummy', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::collection(Type::object('dummy'), Type::object('relatedDummy')))->withDescription('This is a name.')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)); // @phpstan-ignore-line
×
91
        $propertyMetadataFactoryProphecy->create('dummy', 'iri', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withIris(['https://schema.org/Dummy']));
×
92

UNCOV
93
        $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
×
94
        $resourceClassResolverProphecy->isResourceClass(Argument::type('string'))->willReturn(true);
×
95

96
        $urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
×
UNCOV
97
        $urlGenerator->generate('api_entrypoint')->willReturn('/')->shouldBeCalledTimes(1);
×
98
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'])->willReturn('/doc')->shouldBeCalledTimes(1);
×
99

100
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'], 0)->willReturn('/doc')->shouldBeCalledTimes(1);
×
101

102
        $documentationNormalizer = new DocumentationNormalizer(
×
103
            $resourceMetadataFactory,
×
104
            $propertyNameCollectionFactoryProphecy->reveal(),
×
105
            $propertyMetadataFactoryProphecy->reveal(),
×
106
            $resourceClassResolverProphecy->reveal(),
×
107
            $urlGenerator->reveal(),
×
UNCOV
108
            new CustomConverter()
×
109
        );
×
110

111
        $expected = [
×
112
            '@context' => [
×
113
                HYDRA_CONTEXT,
×
114
                [
×
115
                    '@vocab' => '/doc#',
×
116
                    'hydra' => 'http://www.w3.org/ns/hydra/core#',
×
117
                    'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
×
118
                    'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
×
119
                    'xmls' => 'http://www.w3.org/2001/XMLSchema#',
×
120
                    'owl' => 'http://www.w3.org/2002/07/owl#',
×
121
                    'schema' => 'https://schema.org/',
×
122
                    'domain' => [
×
123
                        '@id' => 'rdfs:domain',
×
124
                        '@type' => '@id',
×
125
                    ],
×
126
                    'range' => [
×
127
                        '@id' => 'rdfs:range',
×
128
                        '@type' => '@id',
×
129
                    ],
×
130
                    'subClassOf' => [
×
131
                        '@id' => 'rdfs:subClassOf',
×
132
                        '@type' => '@id',
×
133
                    ],
×
134
                ],
×
135
            ],
×
136
            '@id' => '/doc',
×
137
            '@type' => 'hydra:ApiDocumentation',
×
138
            'hydra:title' => 'Test Api',
×
139
            'hydra:description' => 'test ApiGerard',
×
140
            'hydra:supportedClass' => [
×
141
                [
×
142
                    '@id' => '#dummy',
×
143
                    '@type' => 'hydra:Class',
×
144
                    'hydra:title' => 'dummy',
×
145
                    'hydra:description' => 'dummy',
×
146
                    'hydra:supportedProperty' => [
×
147
                        [
×
148
                            '@type' => 'hydra:SupportedProperty',
×
149
                            'hydra:property' => [
×
150
                                '@id' => '#dummy/name',
×
151
                                '@type' => 'rdf:Property',
×
152
                                'label' => 'name',
×
153
                                'domain' => '#dummy',
×
154
                                'range' => 'xmls:string',
×
155
                            ],
×
156
                            'hydra:title' => 'name',
×
157
                            'hydra:required' => false,
×
158
                            'hydra:readable' => true,
×
159
                            'hydra:writeable' => true,
×
160
                            'hydra:description' => 'name',
×
161
                        ],
×
162
                        [
×
163
                            '@type' => 'hydra:SupportedProperty',
×
164
                            'hydra:property' => [
×
165
                                '@id' => '#dummy/description',
×
166
                                '@type' => 'rdf:Property',
×
167
                                'label' => 'description',
×
168
                                'domain' => '#dummy',
×
169
                                'range' => '@id',
×
170
                            ],
×
171
                            'hydra:title' => 'description',
×
172
                            'hydra:required' => false,
×
173
                            'hydra:readable' => true,
×
174
                            'hydra:writeable' => true,
×
175
                            'hydra:description' => 'description',
×
176
                        ],
×
177
                        [
×
178
                            '@type' => 'hydra:SupportedProperty',
×
179
                            'hydra:property' => [
×
180
                                '@id' => '#dummy/name_converted',
×
181
                                '@type' => 'rdf:Property',
×
182
                                'label' => 'name_converted',
×
183
                                'domain' => '#dummy',
×
184
                                'range' => 'xmls:string',
×
185
                            ],
×
186
                            'hydra:title' => 'name_converted',
×
187
                            'hydra:required' => false,
×
188
                            'hydra:readable' => true,
×
189
                            'hydra:writeable' => true,
×
190
                            'hydra:description' => 'name converted',
×
191
                        ],
×
192
                        [
×
193
                            '@type' => 'hydra:SupportedProperty',
×
194
                            'hydra:property' => [
×
195
                                '@id' => '#dummy/relatedDummy',
×
196
                                '@type' => 'rdf:Property',
×
197
                                'label' => 'relatedDummy',
×
198
                                'domain' => '#dummy',
×
199
                                'range' => '#relatedDummy',
×
200
                            ],
×
201
                            'hydra:title' => 'relatedDummy',
×
202
                            'hydra:required' => false,
×
203
                            'hydra:readable' => true,
×
204
                            'hydra:writeable' => true,
×
205
                            'hydra:description' => 'This is a name.',
×
206
                        ],
×
207
                        [
×
208
                            '@type' => 'hydra:SupportedProperty',
×
209
                            'hydra:property' => [
×
210
                                '@id' => 'https://schema.org/Dummy',
×
211
                                '@type' => 'rdf:Property',
×
212
                                'label' => 'iri',
×
213
                                'domain' => '#dummy',
×
214
                            ],
×
215
                            'hydra:title' => 'iri',
×
216
                            'hydra:required' => null,
×
217
                            'hydra:readable' => null,
×
218
                            'hydra:writeable' => false,
×
219
                        ],
×
220
                    ],
×
221
                    'hydra:supportedOperation' => [
×
222
                        [
×
223
                            '@type' => ['hydra:Operation', 'schema:FindAction'],
×
224
                            'hydra:method' => 'GET',
×
225
                            'hydra:title' => 'foobar',
×
226
                            'returns' => 'dummy',
×
227
                            'hydra:foo' => 'bar',
×
228
                            'hydra:description' => 'Retrieves a dummy resource.',
×
229
                        ],
×
230
                        [
×
231
                            '@type' => ['hydra:Operation', 'schema:ReplaceAction'],
×
232
                            'expects' => 'dummy',
×
233
                            'hydra:method' => 'PUT',
×
234
                            'hydra:title' => 'putdummy',
×
235
                            'hydra:description' => 'Replaces the dummy resource.',
×
236
                            'returns' => 'dummy',
×
237
                        ],
×
238
                        [
×
239
                            '@type' => ['hydra:Operation', 'schema:FindAction'],
×
240
                            'hydra:method' => 'GET',
×
241
                            'hydra:title' => 'getrelatedDummy',
×
242
                            'hydra:description' => 'Retrieves a relatedDummy resource.',
×
243
                            'returns' => 'relatedDummy',
×
244
                        ],
×
245
                    ],
×
246
                ],
×
247
                [
×
248
                    '@id' => '#Entrypoint',
×
249
                    '@type' => 'hydra:Class',
×
250
                    'hydra:title' => 'Entrypoint',
×
251
                    'hydra:supportedProperty' => [
×
252
                        [
×
253
                            '@type' => 'hydra:SupportedProperty',
×
254
                            'hydra:property' => [
×
255
                                '@id' => '#Entrypoint/dummy',
×
256
                                '@type' => 'hydra:Link',
×
257
                                'domain' => '#Entrypoint',
×
258
                                'range' => [
×
259
                                    ['@id' => 'hydra:Collection'],
×
260
                                    [
×
261
                                        'owl:equivalentClass' => [
×
262
                                            'owl:onProperty' => ['@id' => 'hydra:member'],
×
263
                                            'owl:allValuesFrom' => ['@id' => '#dummy'],
×
264
                                        ],
×
265
                                    ],
×
266
                                ],
×
267
                                'owl:maxCardinality' => 1,
×
268
                                'hydra:supportedOperation' => [
×
269
                                    [
×
270
                                        '@type' => ['hydra:Operation', 'schema:FindAction'],
×
271
                                        'hydra:method' => 'GET',
×
272
                                        'hydra:title' => 'getdummyCollection',
×
273
                                        'hydra:description' => 'Retrieves the collection of dummy resources.',
×
274
                                        'returns' => 'hydra:Collection',
×
275
                                    ],
×
276
                                    [
×
277
                                        '@type' => ['hydra:Operation', 'schema:CreateAction'],
×
278
                                        'expects' => 'dummy',
×
279
                                        'hydra:method' => 'POST',
×
280
                                        'hydra:title' => 'postdummy',
×
281
                                        'hydra:description' => 'Creates a dummy resource.',
×
282
                                        'returns' => 'dummy',
×
283
                                    ],
×
284
                                ],
×
285
                            ],
×
286
                            'hydra:title' => 'getdummyCollection',
×
287
                            'hydra:description' => 'The collection of dummy resources',
×
288
                            'hydra:readable' => true,
×
289
                            'hydra:writeable' => false,
×
290
                        ],
×
291
                    ],
×
292
                    'hydra:supportedOperation' => [
×
293
                        '@type' => 'hydra:Operation',
×
294
                        'hydra:method' => 'GET',
×
295
                        'hydra:title' => 'index',
×
296
                        'hydra:description' => 'The API Entrypoint.',
×
297
                        'hydra:returns' => 'Entrypoint',
×
298
                    ],
×
299
                ],
×
300
                [
×
301
                    '@id' => '#ConstraintViolationList',
×
302
                    '@type' => 'hydra:Class',
×
303
                    'hydra:title' => 'ConstraintViolationList',
×
304
                    'hydra:description' => 'A constraint violation List.',
×
305
                    'hydra:supportedProperty' => [
×
306
                        [
×
307
                            '@type' => 'hydra:SupportedProperty',
×
308
                            'hydra:property' => [
×
309
                                '@id' => '#ConstraintViolationList/propertyPath',
×
310
                                '@type' => 'rdf:Property',
×
311
                                'rdfs:label' => 'propertyPath',
×
312
                                'domain' => '#ConstraintViolationList',
×
313
                                'range' => 'xmls:string',
×
314
                            ],
×
315
                            'hydra:title' => 'propertyPath',
×
316
                            'hydra:description' => 'The property path of the violation',
×
317
                            'hydra:readable' => true,
×
318
                            'hydra:writeable' => false,
×
319
                        ],
×
320
                        [
×
321
                            '@type' => 'hydra:SupportedProperty',
×
322
                            'hydra:property' => [
×
323
                                '@id' => '#ConstraintViolationList/message',
×
324
                                '@type' => 'rdf:Property',
×
325
                                'rdfs:label' => 'message',
×
326
                                'domain' => '#ConstraintViolationList',
×
327
                                'range' => 'xmls:string',
×
328
                            ],
×
329
                            'hydra:title' => 'message',
×
330
                            'hydra:description' => 'The message associated with the violation',
×
331
                            'hydra:readable' => true,
×
332
                            'hydra:writeable' => false,
×
333
                        ],
×
334
                    ],
×
335
                ],
×
336
            ],
×
UNCOV
337
            'hydra:entrypoint' => '/',
×
338
        ];
×
339

340
        $this->assertEquals($expected, $documentationNormalizer->normalize($documentation));
×
341
        $this->assertTrue($documentationNormalizer->supportsNormalization($documentation, 'jsonld'));
×
342
        $this->assertFalse($documentationNormalizer->supportsNormalization($documentation, 'hal'));
×
UNCOV
343
        $this->assertEmpty($documentationNormalizer->getSupportedTypes('json'));
×
UNCOV
344
        $this->assertSame([Documentation::class => true], $documentationNormalizer->getSupportedTypes($documentationNormalizer::FORMAT));
×
345
    }
346

347
    public function testNormalizeInputOutputClass(): void
348
    {
349
        $title = 'Test Api';
×
350
        $desc = 'test ApiGerard';
×
UNCOV
351
        $version = '0.0.0';
×
352
        $documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']), $title, $desc, $version);
×
353

354
        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
×
355
        $propertyNameCollectionFactoryProphecy->create('inputClass', Argument::type('array'))->shouldBeCalled()->willReturn(new PropertyNameCollection(['a', 'b']));
×
UNCOV
356
        $propertyNameCollectionFactoryProphecy->create('outputClass', Argument::type('array'))->shouldBeCalled()->willReturn(new PropertyNameCollection(['c', 'd']));
×
357
        $propertyNameCollectionFactoryProphecy->create('dummy', Argument::type('array'))->shouldBeCalled()->willReturn(new PropertyNameCollection([]));
×
358

359
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
×
360
        $resourceMetadataFactoryProphecy->create('dummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('dummy', [
×
361
            (new ApiResource())->withShortName('dummy')->withDescription('dummy')->withTypes(['#dummy'])->withOperations(new Operations([
×
362
                'get' => (new Get())->withTypes(['#dummy'])->withShortName('dummy')->withInput(['class' => 'inputClass'])->withOutput(['class' => 'outputClass']),
×
363
                'put' => (new Put())->withShortName('dummy')->withInput(['class' => null])->withOutput(['class' => 'outputClass']),
×
364
                'get_collection' => (new GetCollection())->withShortName('dummy')->withInput(['class' => 'inputClass'])->withOutput(['class' => 'outputClass']),
×
365
                'post' => (new Post())->withShortName('dummy')->withOutput(['class' => null])->withInput(['class' => 'inputClass']),
×
UNCOV
366
            ])),
×
367
        ]));
×
368

369
        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
×
370
        $propertyMetadataFactoryProphecy->create('inputClass', 'a', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::string())->withDescription('a')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true));
×
371
        $propertyMetadataFactoryProphecy->create('inputClass', 'b', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::string())->withDescription('b')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true));
×
UNCOV
372
        $propertyMetadataFactoryProphecy->create('outputClass', 'c', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::string())->withDescription('c')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true));
×
373
        $propertyMetadataFactoryProphecy->create('outputClass', 'd', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::string())->withDescription('d')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true));
×
374

UNCOV
375
        $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
×
376
        $resourceClassResolverProphecy->isResourceClass(Argument::type('string'))->willReturn(true);
×
377

378
        $urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
×
379
        $urlGenerator->generate('api_entrypoint')->willReturn('/')->shouldBeCalledTimes(1);
×
UNCOV
380
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'])->willReturn('/doc')->shouldBeCalledTimes(1);
×
381
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'], 0)->willReturn('/doc')->shouldBeCalledTimes(1);
×
382

383
        $documentationNormalizer = new DocumentationNormalizer(
×
384
            $resourceMetadataFactoryProphecy->reveal(),
×
385
            $propertyNameCollectionFactoryProphecy->reveal(),
×
386
            $propertyMetadataFactoryProphecy->reveal(),
×
387
            $resourceClassResolverProphecy->reveal(),
×
UNCOV
388
            $urlGenerator->reveal()
×
389
        );
×
390

391
        $expected = [
×
392
            '@id' => '#dummy',
×
393
            '@type' => 'hydra:Class',
×
394
            'hydra:title' => 'dummy',
×
395
            'hydra:supportedProperty' => [
×
396
                [
×
397
                    '@type' => 'hydra:SupportedProperty',
×
398
                    'hydra:property' => [
×
399
                        '@id' => '#dummy/a',
×
400
                        '@type' => 'rdf:Property',
×
401
                        'label' => 'a',
×
402
                        'domain' => '#dummy',
×
403
                        'range' => 'xmls:string',
×
404
                    ],
×
405
                    'hydra:title' => 'a',
×
406
                    'hydra:required' => false,
×
407
                    'hydra:readable' => true,
×
408
                    'hydra:writeable' => true,
×
409
                    'hydra:description' => 'a',
×
410
                ],
×
411
                [
×
412
                    '@type' => 'hydra:SupportedProperty',
×
413
                    'hydra:property' => [
×
414
                        '@id' => '#dummy/b',
×
415
                        '@type' => 'rdf:Property',
×
416
                        'label' => 'b',
×
417
                        'domain' => '#dummy',
×
418
                        'range' => 'xmls:string',
×
419
                    ],
×
420
                    'hydra:title' => 'b',
×
421
                    'hydra:required' => false,
×
422
                    'hydra:readable' => true,
×
423
                    'hydra:writeable' => true,
×
424
                    'hydra:description' => 'b',
×
425
                ],
×
426
                [
×
427
                    '@type' => 'hydra:SupportedProperty',
×
428
                    'hydra:property' => [
×
429
                        '@id' => '#dummy/c',
×
430
                        '@type' => 'rdf:Property',
×
431
                        'label' => 'c',
×
432
                        'domain' => '#dummy',
×
433
                        'range' => 'xmls:string',
×
434
                    ],
×
435
                    'hydra:title' => 'c',
×
436
                    'hydra:required' => false,
×
437
                    'hydra:readable' => true,
×
438
                    'hydra:writeable' => true,
×
439
                    'hydra:description' => 'c',
×
440
                ],
×
441
                [
×
442
                    '@type' => 'hydra:SupportedProperty',
×
443
                    'hydra:property' => [
×
444
                        '@id' => '#dummy/d',
×
445
                        '@type' => 'rdf:Property',
×
446
                        'label' => 'd',
×
447
                        'domain' => '#dummy',
×
448
                        'range' => 'xmls:string',
×
449
                    ],
×
450
                    'hydra:title' => 'd',
×
451
                    'hydra:required' => false,
×
452
                    'hydra:readable' => true,
×
453
                    'hydra:writeable' => true,
×
454
                    'hydra:description' => 'd',
×
455
                ],
×
456
            ],
×
457
            'hydra:supportedOperation' => [
×
458
                [
×
459
                    '@type' => [
×
460
                        'hydra:Operation',
×
461
                        'schema:FindAction',
×
462
                    ],
×
463
                    'hydra:method' => 'GET',
×
464
                    'hydra:title' => 'getdummy',
×
465
                    'hydra:description' => 'Retrieves a dummy resource.',
×
466
                    'returns' => 'dummy',
×
467
                ],
×
468
                [
×
469
                    '@type' => [
×
470
                        'hydra:Operation',
×
471
                        'schema:ReplaceAction',
×
472
                    ],
×
473
                    'expects' => 'owl:Nothing',
×
474
                    'hydra:method' => 'PUT',
×
475
                    'hydra:title' => 'putdummy',
×
476
                    'hydra:description' => 'Replaces the dummy resource.',
×
477
                    'returns' => 'dummy',
×
478
                ],
×
479
            ],
×
UNCOV
480
            'hydra:description' => 'dummy',
×
481
        ];
×
482

UNCOV
483
        $doc = $documentationNormalizer->normalize($documentation);
×
UNCOV
484
        $this->assertEquals($expected, $doc['hydra:supportedClass'][0]);
×
485
    }
486

487
    public function testHasHydraContext(): void
488
    {
489
        $title = 'Test Api';
×
490
        $desc = 'test ApiGerard';
×
UNCOV
491
        $version = '0.0.0';
×
492
        $documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']), $title, $desc, $version);
×
493

UNCOV
494
        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
×
495
        $propertyNameCollectionFactoryProphecy->create('dummy', Argument::type('array'))->shouldBeCalled()->willReturn(new PropertyNameCollection(['name']));
×
496

497
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
×
498
        $resourceMetadataFactoryProphecy->create('dummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('dummy', [
×
499
            (new ApiResource())->withShortName('dummy')->withDescription('dummy')->withTypes(['#dummy'])->withOperations(new Operations([
×
500
                'get' => (new Get())->withTypes(['#dummy'])->withShortName('dummy')->withInput(['class' => 'inputClass'])->withOutput(['class' => 'outputClass']),
×
UNCOV
501
            ])),
×
502
        ]));
×
503

504
        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
×
505
        $propertyMetadataFactoryProphecy->create('dummy', 'name', Argument::type('array'))->shouldBeCalled()->willReturn(
×
506
            (new ApiProperty())
×
507
                ->withNativeType(Type::string())
×
508
                ->withDescription('b')
×
509
                ->withReadable(true)
×
510
                ->withWritable(true)
×
511
                ->withJsonldContext([
×
512
                    'hydra:property' => [
×
513
                        '@type' => 'https://schema.org/Enumeration',
×
514
                    ],
×
UNCOV
515
                ])
×
516
        );
×
517

UNCOV
518
        $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
×
519
        $resourceClassResolverProphecy->isResourceClass(Argument::type('string'))->willReturn(true);
×
520

521
        $urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
×
522
        $urlGenerator->generate('api_entrypoint')->willReturn('/')->shouldBeCalledTimes(1);
×
UNCOV
523
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'])->willReturn('/doc')->shouldBeCalledTimes(1);
×
524
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'], 0)->willReturn('/doc')->shouldBeCalledTimes(1);
×
525

526
        $documentationNormalizer = new DocumentationNormalizer(
×
527
            $resourceMetadataFactoryProphecy->reveal(),
×
528
            $propertyNameCollectionFactoryProphecy->reveal(),
×
529
            $propertyMetadataFactoryProphecy->reveal(),
×
530
            $resourceClassResolverProphecy->reveal(),
×
UNCOV
531
            $urlGenerator->reveal()
×
532
        );
×
533

534
        $this->assertEquals([
×
535
            '@id' => '#dummy/name',
×
536
            '@type' => 'https://schema.org/Enumeration',
×
537
            'label' => 'name',
×
538
            'domain' => '#dummy',
×
UNCOV
539
            'range' => 'xmls:string',
×
UNCOV
540
        ], $documentationNormalizer->normalize($documentation)['hydra:supportedClass'][0]['hydra:supportedProperty'][0]['hydra:property']);
×
541
    }
542

543
    public function testNormalizeWithoutPrefix(): void
544
    {
545
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
×
546
        $resourceMetadataFactoryProphecy->create('dummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('dummy', [
×
547
            (new ApiResource())->withShortName('dummy')->withDescription('dummy')->withTypes(['#dummy'])->withOperations(new Operations([
×
548
                'get' => (new Get())->withHydraContext(['foo' => 'bar', 'title' => 'foobar'])->withTypes(['#dummy'])->withShortName('dummy'),
×
549
                'put' => (new Put())->withShortName('dummy'),
×
550
                'get_collection' => (new GetCollection())->withShortName('dummy'),
×
551
                'post' => (new Post())->withShortName('dummy'),
×
552
            ])),
×
553
            (new ApiResource())->withShortName('relatedDummy')->withOperations(new Operations(['get' => (new Get())->withTypes(['#relatedDummy'])->withShortName('relatedDummy')])),
×
554
        ]));
×
555
        $resourceMetadataFactoryProphecy->create('relatedDummy')->shouldBeCalled()->willReturn(new ResourceMetadataCollection('relatedDummy', [
×
UNCOV
556
            (new ApiResource())->withShortName('relatedDummy')->withOperations(new Operations(['get' => (new Get())->withShortName('relatedDummy')])),
×
557
        ]));
×
558

559
        $title = 'Test Api';
×
560
        $desc = 'test ApiGerard';
×
UNCOV
561
        $version = '0.0.0';
×
562
        $documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']), $title, $desc, $version);
×
563

UNCOV
564
        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
×
565
        $propertyNameCollectionFactoryProphecy->create('dummy', [])->shouldBeCalled()->willReturn(new PropertyNameCollection(['name', 'description', 'nameConverted', 'relatedDummy', 'iri']));
×
566

567
        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
×
568
        $propertyMetadataFactoryProphecy->create('dummy', 'name', Argument::type('array'))->shouldBeCalled()->willReturn(
×
569
            (new ApiProperty())->withNativeType(Type::string())->withDescription('name')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)
×
570
        );
×
571
        $propertyMetadataFactoryProphecy->create('dummy', 'description', Argument::type('array'))->shouldBeCalled()->willReturn(
×
572
            (new ApiProperty())->withNativeType(Type::string())->withDescription('description')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)->withJsonldContext(['@type' => '@id'])
×
573
        );
×
574
        $propertyMetadataFactoryProphecy->create('dummy', 'nameConverted', Argument::type('array'))->shouldBeCalled()->willReturn(
×
575
            (new ApiProperty())->withNativeType(Type::string())->withDescription('name converted')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)
×
576
        );
×
UNCOV
577
        $propertyMetadataFactoryProphecy->create('dummy', 'relatedDummy', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withNativeType(Type::collection(Type::object('dummy'), Type::object('relatedDummy')))->withDescription('This is a name.')->withReadable(true)->withWritable(true)->withReadableLink(true)->withWritableLink(true)); // @phpstan-ignore-line
×
578
        $propertyMetadataFactoryProphecy->create('dummy', 'iri', Argument::type('array'))->shouldBeCalled()->willReturn((new ApiProperty())->withIris(['https://schema.org/Dummy']));
×
579

UNCOV
580
        $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
×
581
        $resourceClassResolverProphecy->isResourceClass(Argument::type('string'))->willReturn(true);
×
582

583
        $urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
×
UNCOV
584
        $urlGenerator->generate('api_entrypoint')->willReturn('/')->shouldBeCalledTimes(1);
×
585
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'])->willReturn('/doc')->shouldBeCalledTimes(1);
×
586

587
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'], 0)->willReturn('/doc')->shouldBeCalledTimes(1);
×
588

589
        $documentationNormalizer = new DocumentationNormalizer(
×
590
            $resourceMetadataFactoryProphecy->reveal(),
×
591
            $propertyNameCollectionFactoryProphecy->reveal(),
×
592
            $propertyMetadataFactoryProphecy->reveal(),
×
593
            $resourceClassResolverProphecy->reveal(),
×
594
            $urlGenerator->reveal(),
×
UNCOV
595
            new CustomConverter()
×
596
        );
×
597

598
        $expected = [
×
599
            '@context' => [
×
600
                HYDRA_CONTEXT,
×
601
                [
×
602
                    '@vocab' => '/doc#',
×
603
                    'hydra' => 'http://www.w3.org/ns/hydra/core#',
×
604
                    'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
×
605
                    'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
×
606
                    'xmls' => 'http://www.w3.org/2001/XMLSchema#',
×
607
                    'owl' => 'http://www.w3.org/2002/07/owl#',
×
608
                    'schema' => 'https://schema.org/',
×
609
                    'domain' => [
×
610
                        '@id' => 'rdfs:domain',
×
611
                        '@type' => '@id',
×
612
                    ],
×
613
                    'range' => [
×
614
                        '@id' => 'rdfs:range',
×
615
                        '@type' => '@id',
×
616
                    ],
×
617
                    'subClassOf' => [
×
618
                        '@id' => 'rdfs:subClassOf',
×
619
                        '@type' => '@id',
×
620
                    ],
×
621
                ],
×
622
            ],
×
623
            '@id' => '/doc',
×
624
            '@type' => 'ApiDocumentation',
×
625
            'title' => 'Test Api',
×
626
            'description' => 'test ApiGerard',
×
627
            'supportedClass' => [
×
628
                [
×
629
                    '@id' => '#dummy',
×
630
                    '@type' => 'Class',
×
631
                    'title' => 'dummy',
×
632
                    'description' => 'dummy',
×
633
                    'supportedProperty' => [
×
634
                        [
×
635
                            '@type' => 'SupportedProperty',
×
636
                            'property' => [
×
637
                                '@id' => '#dummy/name',
×
638
                                '@type' => 'rdf:Property',
×
639
                                'label' => 'name',
×
640
                                'domain' => '#dummy',
×
641
                                'range' => 'xmls:string',
×
642
                            ],
×
643
                            'title' => 'name',
×
644
                            'required' => false,
×
645
                            'readable' => true,
×
646
                            'writeable' => true,
×
647
                            'description' => 'name',
×
648
                        ],
×
649
                        [
×
650
                            '@type' => 'SupportedProperty',
×
651
                            'property' => [
×
652
                                '@id' => '#dummy/description',
×
653
                                '@type' => 'rdf:Property',
×
654
                                'label' => 'description',
×
655
                                'domain' => '#dummy',
×
656
                                'range' => '@id',
×
657
                            ],
×
658
                            'title' => 'description',
×
659
                            'required' => false,
×
660
                            'readable' => true,
×
661
                            'writeable' => true,
×
662
                            'description' => 'description',
×
663
                        ],
×
664
                        [
×
665
                            '@type' => 'SupportedProperty',
×
666
                            'property' => [
×
667
                                '@id' => '#dummy/name_converted',
×
668
                                '@type' => 'rdf:Property',
×
669
                                'label' => 'name_converted',
×
670
                                'domain' => '#dummy',
×
671
                                'range' => 'xmls:string',
×
672
                            ],
×
673
                            'title' => 'name_converted',
×
674
                            'required' => false,
×
675
                            'readable' => true,
×
676
                            'writeable' => true,
×
677
                            'description' => 'name converted',
×
678
                        ],
×
679
                        [
×
680
                            '@type' => 'SupportedProperty',
×
681
                            'property' => [
×
682
                                '@id' => '#dummy/relatedDummy',
×
683
                                '@type' => 'rdf:Property',
×
684
                                'label' => 'relatedDummy',
×
685
                                'domain' => '#dummy',
×
686
                                'range' => '#relatedDummy',
×
687
                            ],
×
688
                            'title' => 'relatedDummy',
×
689
                            'required' => false,
×
690
                            'readable' => true,
×
691
                            'writeable' => true,
×
692
                            'description' => 'This is a name.',
×
693
                        ],
×
694
                        [
×
695
                            '@type' => 'SupportedProperty',
×
696
                            'property' => [
×
697
                                '@id' => 'https://schema.org/Dummy',
×
698
                                '@type' => 'rdf:Property',
×
699
                                'label' => 'iri',
×
700
                                'domain' => '#dummy',
×
701
                            ],
×
702
                            'title' => 'iri',
×
703
                            'required' => null,
×
704
                            'readable' => null,
×
705
                            'writeable' => false,
×
706
                        ],
×
707
                    ],
×
708
                    'supportedOperation' => [
×
709
                        [
×
710
                            '@type' => ['Operation', 'schema:FindAction'],
×
711
                            'method' => 'GET',
×
712
                            'title' => 'foobar',
×
713
                            'returns' => 'dummy',
×
714
                            'foo' => 'bar',
×
715
                            'description' => 'Retrieves a dummy resource.',
×
716
                        ],
×
717
                        [
×
718
                            '@type' => ['Operation', 'schema:ReplaceAction'],
×
719
                            'expects' => 'dummy',
×
720
                            'method' => 'PUT',
×
721
                            'title' => 'putdummy',
×
722
                            'description' => 'Replaces the dummy resource.',
×
723
                            'returns' => 'dummy',
×
724
                        ],
×
725
                        [
×
726
                            '@type' => ['Operation', 'schema:FindAction'],
×
727
                            'method' => 'GET',
×
728
                            'title' => 'getrelatedDummy',
×
729
                            'description' => 'Retrieves a relatedDummy resource.',
×
730
                            'returns' => 'relatedDummy',
×
731
                        ],
×
732
                    ],
×
733
                ],
×
734
                [
×
735
                    '@id' => '#Entrypoint',
×
736
                    '@type' => 'Class',
×
737
                    'title' => 'Entrypoint',
×
738
                    'supportedProperty' => [
×
739
                        [
×
740
                            '@type' => 'SupportedProperty',
×
741
                            'property' => [
×
742
                                '@id' => '#Entrypoint/dummy',
×
743
                                '@type' => 'Link',
×
744
                                'domain' => '#Entrypoint',
×
745
                                'range' => [
×
746
                                    ['@id' => 'Collection'],
×
747
                                    [
×
748
                                        'owl:equivalentClass' => [
×
749
                                            'owl:onProperty' => ['@id' => 'member'],
×
750
                                            'owl:allValuesFrom' => ['@id' => '#dummy'],
×
751
                                        ],
×
752
                                    ],
×
753
                                ],
×
754
                                'owl:maxCardinality' => 1,
×
755
                                'supportedOperation' => [
×
756
                                    [
×
757
                                        '@type' => ['Operation', 'schema:FindAction'],
×
758
                                        'method' => 'GET',
×
759
                                        'title' => 'getdummyCollection',
×
760
                                        'description' => 'Retrieves the collection of dummy resources.',
×
761
                                        'returns' => 'Collection',
×
762
                                    ],
×
763
                                    [
×
764
                                        '@type' => ['Operation', 'schema:CreateAction'],
×
765
                                        'expects' => 'dummy',
×
766
                                        'method' => 'POST',
×
767
                                        'title' => 'postdummy',
×
768
                                        'description' => 'Creates a dummy resource.',
×
769
                                        'returns' => 'dummy',
×
770
                                    ],
×
771
                                ],
×
772
                            ],
×
773
                            'title' => 'getdummyCollection',
×
774
                            'description' => 'The collection of dummy resources',
×
775
                            'readable' => true,
×
776
                            'writeable' => false,
×
777
                        ],
×
778
                    ],
×
779
                    'supportedOperation' => [
×
780
                        '@type' => 'Operation',
×
781
                        'method' => 'GET',
×
782
                        'title' => 'index',
×
783
                        'description' => 'The API Entrypoint.',
×
784
                        'returns' => 'Entrypoint',
×
785
                    ],
×
786
                ],
×
787
                [
×
788
                    '@id' => '#ConstraintViolationList',
×
789
                    '@type' => 'Class',
×
790
                    'title' => 'ConstraintViolationList',
×
791
                    'description' => 'A constraint violation List.',
×
792
                    'supportedProperty' => [
×
793
                        [
×
794
                            '@type' => 'SupportedProperty',
×
795
                            'property' => [
×
796
                                '@id' => '#ConstraintViolationList/propertyPath',
×
797
                                '@type' => 'rdf:Property',
×
798
                                'rdfs:label' => 'propertyPath',
×
799
                                'domain' => '#ConstraintViolationList',
×
800
                                'range' => 'xmls:string',
×
801
                            ],
×
802
                            'title' => 'propertyPath',
×
803
                            'description' => 'The property path of the violation',
×
804
                            'readable' => true,
×
805
                            'writeable' => false,
×
806
                        ],
×
807
                        [
×
808
                            '@type' => 'SupportedProperty',
×
809
                            'property' => [
×
810
                                '@id' => '#ConstraintViolationList/message',
×
811
                                '@type' => 'rdf:Property',
×
812
                                'rdfs:label' => 'message',
×
813
                                'domain' => '#ConstraintViolationList',
×
814
                                'range' => 'xmls:string',
×
815
                            ],
×
816
                            'title' => 'message',
×
817
                            'description' => 'The message associated with the violation',
×
818
                            'readable' => true,
×
819
                            'writeable' => false,
×
820
                        ],
×
821
                    ],
×
822
                ],
×
823
            ],
×
UNCOV
824
            'entrypoint' => '/',
×
825
        ];
×
826

UNCOV
827
        $this->assertEquals($expected, $documentationNormalizer->normalize($documentation, null, [ContextBuilder::HYDRA_CONTEXT_HAS_PREFIX => false]));
×
828
    }
829

830
    public function testNormalizeNoEntrypointAndHideHydraOperation(): void
831
    {
832
        $title = 'Test Api';
×
833
        $desc = 'test ApiGerard';
×
UNCOV
834
        $version = '0.0.0';
×
835
        $documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']), $title, $desc, $version);
×
836

837
        $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
×
838
        $resourceMetadataFactoryProphecy->create('dummy')->willReturn(new ResourceMetadataCollection('dummy', [
×
839
            (new ApiResource())->withHideHydraOperation(true)->withOperations(new Operations([
×
840
                'get' => new Get(),
×
841
            ])),
×
842
        ]));
×
843
        $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
×
844
        $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
×
845
        $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
×
UNCOV
846
        $urlGenerator = $this->prophesize(UrlGeneratorInterface::class);
×
847
        $urlGenerator->generate('api_doc', ['_format' => 'jsonld'], Argument::any())->willReturn('/doc');
×
848

849
        $documentationNormalizer = new DocumentationNormalizer(
×
850
            $resourceMetadataFactoryProphecy->reveal(),
×
851
            $propertyNameCollectionFactoryProphecy->reveal(),
×
852
            $propertyMetadataFactoryProphecy->reveal(),
×
853
            $resourceClassResolverProphecy->reveal(),
×
854
            $urlGenerator->reveal(),
×
855
            new CustomConverter(),
×
856
            [],
×
UNCOV
857
            false,
×
858
        );
×
859

860
        $expected = [
×
861
            '@context' => [
×
862
                HYDRA_CONTEXT,
×
863
                [
×
864
                    '@vocab' => '/doc#',
×
865
                    'hydra' => 'http://www.w3.org/ns/hydra/core#',
×
866
                    'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
×
867
                    'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
×
868
                    'xmls' => 'http://www.w3.org/2001/XMLSchema#',
×
869
                    'owl' => 'http://www.w3.org/2002/07/owl#',
×
870
                    'schema' => 'https://schema.org/',
×
871
                    'domain' => [
×
872
                        '@id' => 'rdfs:domain',
×
873
                        '@type' => '@id',
×
874
                    ],
×
875
                    'range' => [
×
876
                        '@id' => 'rdfs:range',
×
877
                        '@type' => '@id',
×
878
                    ],
×
879
                    'subClassOf' => [
×
880
                        '@id' => 'rdfs:subClassOf',
×
881
                        '@type' => '@id',
×
882
                    ],
×
883
                ],
×
884
            ],
×
885
            '@id' => '/doc',
×
886
            '@type' => 'ApiDocumentation',
×
887
            'title' => 'Test Api',
×
888
            'description' => 'test ApiGerard',
×
889
            'supportedClass' => [
×
890
                [
×
891
                    '@id' => '#ConstraintViolationList',
×
892
                    '@type' => 'Class',
×
893
                    'title' => 'ConstraintViolationList',
×
894
                    'description' => 'A constraint violation List.',
×
895
                    'supportedProperty' => [
×
896
                        [
×
897
                            '@type' => 'SupportedProperty',
×
898
                            'property' => [
×
899
                                '@id' => '#ConstraintViolationList/propertyPath',
×
900
                                '@type' => 'rdf:Property',
×
901
                                'rdfs:label' => 'propertyPath',
×
902
                                'domain' => '#ConstraintViolationList',
×
903
                                'range' => 'xmls:string',
×
904
                            ],
×
905
                            'title' => 'propertyPath',
×
906
                            'description' => 'The property path of the violation',
×
907
                            'readable' => true,
×
908
                            'writeable' => false,
×
909
                        ],
×
910
                        [
×
911
                            '@type' => 'SupportedProperty',
×
912
                            'property' => [
×
913
                                '@id' => '#ConstraintViolationList/message',
×
914
                                '@type' => 'rdf:Property',
×
915
                                'rdfs:label' => 'message',
×
916
                                'domain' => '#ConstraintViolationList',
×
917
                                'range' => 'xmls:string',
×
918
                            ],
×
919
                            'title' => 'message',
×
920
                            'description' => 'The message associated with the violation',
×
921
                            'readable' => true,
×
922
                            'writeable' => false,
×
923
                        ],
×
924
                    ],
×
925
                ],
×
UNCOV
926
            ],
×
927
        ];
×
928

UNCOV
929
        $this->assertEquals($expected, $documentationNormalizer->normalize($documentation, null, [ContextBuilder::HYDRA_CONTEXT_HAS_PREFIX => false]));
×
930
    }
931
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc