Skip to content

Commit 960f62f

Browse files
authored
Add a test for exists filter on a collection relation (#3482)
1 parent 782c18f commit 960f62f

File tree

5 files changed

+109
-358
lines changed

5 files changed

+109
-358
lines changed

features/doctrine/date_filter.feature

Lines changed: 19 additions & 351 deletions
Original file line numberDiff line numberDiff line change
@@ -424,360 +424,28 @@ Feature: Date filter on collections
424424
Then the response status code should be 200
425425
And the response should be in JSON
426426
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
427-
And the JSON should be equal to:
427+
And the JSON should be valid according to this schema:
428428
"""
429429
{
430-
"@context": "/contexts/Dummy",
431-
"@id": "/dummies",
432-
"@type": "hydra:Collection",
433-
"hydra:member": [],
434-
"hydra:totalItems": 0,
435-
"hydra:view": {
436-
"@id": "/dummies?relatedDummy.dummyDate%5Bafter%5D=2015-04-28",
437-
"@type": "hydra:PartialCollectionView"
438-
},
439-
"hydra:search": {
440-
"@type": "hydra:IriTemplate",
441-
"hydra:template": "/dummies{?dummyBoolean,relatedDummy.embeddedDummy.dummyBoolean,dummyDate[before],dummyDate[strictly_before],dummyDate[after],dummyDate[strictly_after],relatedDummy.dummyDate[before],relatedDummy.dummyDate[strictly_before],relatedDummy.dummyDate[after],relatedDummy.dummyDate[strictly_after],exists[alias],exists[description],exists[relatedDummy.name],exists[dummyBoolean],exists[relatedDummy],dummyFloat,dummyFloat[],dummyPrice,dummyPrice[],order[id],order[name],order[description],order[relatedDummy.name],order[relatedDummy.symfony],order[dummyDate],dummyFloat[between],dummyFloat[gt],dummyFloat[gte],dummyFloat[lt],dummyFloat[lte],dummyPrice[between],dummyPrice[gt],dummyPrice[gte],dummyPrice[lt],dummyPrice[lte],id,id[],name,alias,description,relatedDummy.name,relatedDummy.name[],relatedDummies,relatedDummies[],dummy,relatedDummies.name,relatedDummy.thirdLevel.level,relatedDummy.thirdLevel.level[],relatedDummy.thirdLevel.fourthLevel.level,relatedDummy.thirdLevel.fourthLevel.level[],relatedDummy.thirdLevel.badFourthLevel.level,relatedDummy.thirdLevel.badFourthLevel.level[],relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level,relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level[],name_converted,properties[]}",
442-
"hydra:variableRepresentation": "BasicRepresentation",
443-
"hydra:mapping": [
444-
{
445-
"@type": "IriTemplateMapping",
446-
"variable": "dummyBoolean",
447-
"property": "dummyBoolean",
448-
"required": false
449-
},
450-
{
451-
"@type": "IriTemplateMapping",
452-
"variable": "relatedDummy.embeddedDummy.dummyBoolean",
453-
"property": "relatedDummy.embeddedDummy.dummyBoolean",
454-
"required": false
455-
},
456-
{
457-
"@type": "IriTemplateMapping",
458-
"variable": "dummyDate[before]",
459-
"property": "dummyDate",
460-
"required": false
461-
},
462-
{
463-
"@type": "IriTemplateMapping",
464-
"variable": "dummyDate[strictly_before]",
465-
"property": "dummyDate",
466-
"required": false
467-
},
468-
{
469-
"@type": "IriTemplateMapping",
470-
"variable": "dummyDate[after]",
471-
"property": "dummyDate",
472-
"required": false
473-
},
474-
{
475-
"@type": "IriTemplateMapping",
476-
"variable": "dummyDate[strictly_after]",
477-
"property": "dummyDate",
478-
"required": false
479-
},
480-
{
481-
"@type": "IriTemplateMapping",
482-
"variable": "relatedDummy.dummyDate[before]",
483-
"property": "relatedDummy.dummyDate",
484-
"required": false
485-
},
486-
{
487-
"@type": "IriTemplateMapping",
488-
"variable": "relatedDummy.dummyDate[strictly_before]",
489-
"property": "relatedDummy.dummyDate",
490-
"required": false
491-
},
492-
{
493-
"@type": "IriTemplateMapping",
494-
"variable": "relatedDummy.dummyDate[after]",
495-
"property": "relatedDummy.dummyDate",
496-
"required": false
497-
},
498-
{
499-
"@type": "IriTemplateMapping",
500-
"variable": "relatedDummy.dummyDate[strictly_after]",
501-
"property": "relatedDummy.dummyDate",
502-
"required": false
503-
},
504-
{
505-
"@type": "IriTemplateMapping",
506-
"variable": "exists[alias]",
507-
"property": "alias",
508-
"required": false
509-
},
510-
{
511-
"@type": "IriTemplateMapping",
512-
"variable": "exists[description]",
513-
"property": "description",
514-
"required": false
515-
},
516-
{
517-
"@type": "IriTemplateMapping",
518-
"variable": "exists[relatedDummy.name]",
519-
"property": "relatedDummy.name",
520-
"required": false
521-
},
522-
{
523-
"@type": "IriTemplateMapping",
524-
"variable": "exists[dummyBoolean]",
525-
"property": "dummyBoolean",
526-
"required": false
527-
},
528-
{
529-
"@type": "IriTemplateMapping",
530-
"variable": "exists[relatedDummy]",
531-
"property": "relatedDummy",
532-
"required": false
533-
},
534-
{
535-
"@type": "IriTemplateMapping",
536-
"variable": "dummyFloat",
537-
"property": "dummyFloat",
538-
"required": false
539-
},
540-
{
541-
"@type": "IriTemplateMapping",
542-
"variable": "dummyFloat[]",
543-
"property": "dummyFloat",
544-
"required": false
545-
},
546-
{
547-
"@type": "IriTemplateMapping",
548-
"variable": "dummyPrice",
549-
"property": "dummyPrice",
550-
"required": false
551-
},
552-
{
553-
"@type": "IriTemplateMapping",
554-
"variable": "dummyPrice[]",
555-
"property": "dummyPrice",
556-
"required": false
557-
},
558-
{
559-
"@type": "IriTemplateMapping",
560-
"variable": "order[id]",
561-
"property": "id",
562-
"required": false
563-
},
564-
{
565-
"@type": "IriTemplateMapping",
566-
"variable": "order[name]",
567-
"property": "name",
568-
"required": false
569-
},
570-
{
571-
"@type": "IriTemplateMapping",
572-
"variable": "order[description]",
573-
"property": "description",
574-
"required": false
575-
},
576-
{
577-
"@type": "IriTemplateMapping",
578-
"variable": "order[relatedDummy.name]",
579-
"property": "relatedDummy.name",
580-
"required": false
581-
},
582-
{
583-
"@type": "IriTemplateMapping",
584-
"variable": "order[relatedDummy.symfony]",
585-
"property": "relatedDummy.symfony",
586-
"required": false
587-
},
588-
{
589-
"@type": "IriTemplateMapping",
590-
"variable": "order[dummyDate]",
591-
"property": "dummyDate",
592-
"required": false
593-
},
594-
{
595-
"@type": "IriTemplateMapping",
596-
"variable": "dummyFloat[between]",
597-
"property": "dummyFloat",
598-
"required": false
599-
},
600-
{
601-
"@type": "IriTemplateMapping",
602-
"variable": "dummyFloat[gt]",
603-
"property": "dummyFloat",
604-
"required": false
605-
},
606-
{
607-
"@type": "IriTemplateMapping",
608-
"variable": "dummyFloat[gte]",
609-
"property": "dummyFloat",
610-
"required": false
611-
},
612-
{
613-
"@type": "IriTemplateMapping",
614-
"variable": "dummyFloat[lt]",
615-
"property": "dummyFloat",
616-
"required": false
617-
},
618-
{
619-
"@type": "IriTemplateMapping",
620-
"variable": "dummyFloat[lte]",
621-
"property": "dummyFloat",
622-
"required": false
623-
},
624-
{
625-
"@type": "IriTemplateMapping",
626-
"variable": "dummyPrice[between]",
627-
"property": "dummyPrice",
628-
"required": false
629-
},
630-
{
631-
"@type": "IriTemplateMapping",
632-
"variable": "dummyPrice[gt]",
633-
"property": "dummyPrice",
634-
"required": false
635-
},
636-
{
637-
"@type": "IriTemplateMapping",
638-
"variable": "dummyPrice[gte]",
639-
"property": "dummyPrice",
640-
"required": false
641-
},
642-
{
643-
"@type": "IriTemplateMapping",
644-
"variable": "dummyPrice[lt]",
645-
"property": "dummyPrice",
646-
"required": false
647-
},
648-
{
649-
"@type": "IriTemplateMapping",
650-
"variable": "dummyPrice[lte]",
651-
"property": "dummyPrice",
652-
"required": false
653-
},
654-
{
655-
"@type": "IriTemplateMapping",
656-
"variable": "id",
657-
"property": "id",
658-
"required": false
659-
},
660-
{
661-
"@type": "IriTemplateMapping",
662-
"variable": "id[]",
663-
"property": "id",
664-
"required": false
665-
},
666-
{
667-
"@type": "IriTemplateMapping",
668-
"variable": "name",
669-
"property": "name",
670-
"required": false
671-
},
672-
{
673-
"@type": "IriTemplateMapping",
674-
"variable": "alias",
675-
"property": "alias",
676-
"required": false
677-
},
678-
{
679-
"@type": "IriTemplateMapping",
680-
"variable": "description",
681-
"property": "description",
682-
"required": false
683-
},
684-
{
685-
"@type": "IriTemplateMapping",
686-
"variable": "relatedDummy.name",
687-
"property": "relatedDummy.name",
688-
"required": false
689-
},
690-
{
691-
"@type": "IriTemplateMapping",
692-
"variable": "relatedDummy.name[]",
693-
"property": "relatedDummy.name",
694-
"required": false
695-
},
696-
{
697-
"@type": "IriTemplateMapping",
698-
"variable": "relatedDummies",
699-
"property": "relatedDummies",
700-
"required": false
701-
},
702-
{
703-
"@type": "IriTemplateMapping",
704-
"variable": "relatedDummies[]",
705-
"property": "relatedDummies",
706-
"required": false
707-
},
708-
{
709-
"@type": "IriTemplateMapping",
710-
"variable": "dummy",
711-
"property": "dummy",
712-
"required": false
713-
},
714-
{
715-
"@type": "IriTemplateMapping",
716-
"variable": "relatedDummies.name",
717-
"property": "relatedDummies.name",
718-
"required": false
719-
},
720-
{
721-
"@type": "IriTemplateMapping",
722-
"variable": "relatedDummy.thirdLevel.level",
723-
"property": "relatedDummy.thirdLevel.level",
724-
"required": false
725-
},
726-
{
727-
"@type": "IriTemplateMapping",
728-
"variable": "relatedDummy.thirdLevel.level[]",
729-
"property": "relatedDummy.thirdLevel.level",
730-
"required": false
731-
},
732-
{
733-
"@type": "IriTemplateMapping",
734-
"variable": "relatedDummy.thirdLevel.fourthLevel.level",
735-
"property": "relatedDummy.thirdLevel.fourthLevel.level",
736-
"required": false
737-
},
738-
{
739-
"@type": "IriTemplateMapping",
740-
"variable": "relatedDummy.thirdLevel.fourthLevel.level[]",
741-
"property": "relatedDummy.thirdLevel.fourthLevel.level",
742-
"required": false
743-
},
744-
{
745-
"@type": "IriTemplateMapping",
746-
"variable": "relatedDummy.thirdLevel.badFourthLevel.level",
747-
"property": "relatedDummy.thirdLevel.badFourthLevel.level",
748-
"required": false
749-
},
750-
{
751-
"@type": "IriTemplateMapping",
752-
"variable": "relatedDummy.thirdLevel.badFourthLevel.level[]",
753-
"property": "relatedDummy.thirdLevel.badFourthLevel.level",
754-
"required": false
755-
},
756-
{
757-
"@type": "IriTemplateMapping",
758-
"variable": "relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level",
759-
"property": "relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level",
760-
"required": false
761-
},
762-
{
763-
"@type": "IriTemplateMapping",
764-
"variable": "relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level[]",
765-
"property": "relatedDummy.thirdLevel.fourthLevel.badThirdLevel.level",
766-
"required": false
767-
},
768-
{
769-
"@type": "IriTemplateMapping",
770-
"variable": "name_converted",
771-
"property": "name_converted",
772-
"required": false
430+
"type": "object",
431+
"properties": {
432+
"@context": {"pattern": "^/contexts/Dummy$"},
433+
"@id": {"pattern": "^/dummies$"},
434+
"@type": {"pattern": "^hydra:Collection$"},
435+
"hydra:member": {
436+
"type": "array",
437+
"maxItems": 0
438+
},
439+
"hydra:totalItems": {"type":"number", "maximum": 0},
440+
"hydra:view": {
441+
"type": "object",
442+
"properties": {
443+
"@id": {"pattern": "^/dummies\\?relatedDummy\\.dummyDate%5Bafter%5D=2015-04-28$"},
444+
"@type": {"pattern": "^hydra:PartialCollectionView$"}
773445
},
774-
{
775-
"@type": "IriTemplateMapping",
776-
"variable": "properties[]",
777-
"property": null,
778-
"required": false
779-
}
780-
]
446+
"required": ["@id", "@type"],
447+
"additionalProperties": false
448+
}
781449
}
782450
}
783451
"""

0 commit comments

Comments
 (0)