@@ -99,49 +99,6 @@ public function testItemJson(string $uri, string $mimeType, array $expected): vo
9999 $ this ->assertJsonEquals ($ expected );
100100 }
101101
102- public static function providerEnumItemsGraphQl (): iterable
103- {
104- // Integer cases
105- $ query = <<<'GRAPHQL'
106- query GetAvailability($identifier: ID!) {
107- availability(id: $identifier) {
108- value
109- }
110- }
111- GRAPHQL;
112- foreach (Availability::cases () as $ case ) {
113- yield [$ query , ['identifier ' => '/availabilities/ ' .$ case ->value ], ['data ' => ['availability ' => ['value ' => $ case ->value ]]]];
114- }
115-
116- // String cases
117- $ query = <<<'GRAPHQL'
118- query GetAvailabilityStatus($identifier: ID!) {
119- availabilityStatus(id: $identifier) {
120- value
121- }
122- }
123- GRAPHQL;
124- foreach (AvailabilityStatus::cases () as $ case ) {
125- yield [$ query , ['identifier ' => '/availability_statuses/ ' .$ case ->value ], ['data ' => ['availability_status ' => ['value ' => $ case ->value ]]]];
126- }
127- }
128-
129- /**
130- * @dataProvider providerEnumItemsGraphQl
131- *
132- * @group legacy
133- */
134- public function testItemGraphql (string $ query , array $ variables , array $ expected ): void
135- {
136- $ options = (new HttpOptions ())
137- ->setJson (['query ' => $ query , 'variables ' => $ variables ])
138- ->setHeaders (['Content-Type ' => 'application/json ' ]);
139- self ::createClient ()->request ('POST ' , '/graphql ' , $ options ->toArray ());
140-
141- $ this ->assertResponseIsSuccessful ();
142- $ this ->assertJsonEquals ($ expected );
143- }
144-
145102 public function testCollectionJson (): void
146103 {
147104 self ::createClient ()->request ('GET ' , '/availabilities ' , ['headers ' => ['Accept ' => 'application/json ' ]]);
@@ -500,32 +457,89 @@ public function testItem(string $mimeType, array $expected): void
500457 $ this ->assertJsonEquals ($ expected );
501458 }
502459
503- public function testCollectionGraphQl (): void
460+ public static function provider404s (): iterable
504461 {
505- $ query = <<<'GRAPHQL'
506- query {
507- backedEnumIntegerResources {
508- value
509- }
510- }
511- GRAPHQL;
512- $ options = (new HttpOptions ())
513- ->setJson (['query ' => $ query , 'variables ' => []])
514- ->setHeaders (['Content-Type ' => 'application/json ' ]);
515- self ::createClient ()->request ('POST ' , '/graphql ' , $ options ->toArray ());
462+ yield ['/backed_enum_integer_resources/42 ' ];
463+ yield ['/backed_enum_integer_resources/fortytwo ' ];
464+ }
516465
517- $ this ->assertResponseIsSuccessful ();
518- $ this ->assertJsonEquals ([
519- 'data ' => [
520- 'backedEnumIntegerResources ' => [
521- ['value ' => 1 ],
522- ['value ' => 2 ],
523- ['value ' => 3 ],
524- ],
525- ],
526- ]);
466+ /** @dataProvider provider404s */
467+ public function testItem404 (string $ uri ): void
468+ {
469+ self ::createClient ()->request ('GET ' , $ uri );
470+
471+ $ this ->assertResponseStatusCodeSame (404 );
527472 }
528473
474+ // public static function providerEnumItemsGraphQl(): iterable
475+ // {
476+ // // Integer cases
477+ // $query = <<<'GRAPHQL'
478+ // query GetAvailability($identifier: ID!) {
479+ // availability(id: $identifier) {
480+ // value
481+ // }
482+ // }
483+ // GRAPHQL;
484+ // foreach (Availability::cases() as $case) {
485+ // yield [$query, ['identifier' => '/availabilities/'.$case->value], ['data' => ['availability' => ['value' => $case->value]]]];
486+ // }
487+ //
488+ // // String cases
489+ // $query = <<<'GRAPHQL'
490+ // query GetAvailabilityStatus($identifier: ID!) {
491+ // availabilityStatus(id: $identifier) {
492+ // value
493+ // }
494+ // }
495+ // GRAPHQL;
496+ // foreach (AvailabilityStatus::cases() as $case) {
497+ // yield [$query, ['identifier' => '/availability_statuses/'.$case->value], ['data' => ['availability_status' => ['value' => $case->value]]]];
498+ // }
499+ // }
500+ //
501+ // /**
502+ // * @dataProvider providerEnumItemsGraphQl
503+ // *
504+ // * @group legacy
505+ // */
506+ // public function testItemGraphql(string $query, array $variables, array $expected): void
507+ // {
508+ // $options = (new HttpOptions())
509+ // ->setJson(['query' => $query, 'variables' => $variables])
510+ // ->setHeaders(['Content-Type' => 'application/json']);
511+ // self::createClient()->request('POST', '/graphql', $options->toArray());
512+ //
513+ // $this->assertResponseIsSuccessful();
514+ // $this->assertJsonEquals($expected);
515+ // }
516+ //
517+ // public function testCollectionGraphQl(): void
518+ // {
519+ // $query = <<<'GRAPHQL'
520+ // query {
521+ // backedEnumIntegerResources {
522+ // value
523+ // }
524+ // }
525+ // GRAPHQL;
526+ // $options = (new HttpOptions())
527+ // ->setJson(['query' => $query, 'variables' => []])
528+ // ->setHeaders(['Content-Type' => 'application/json']);
529+ // self::createClient()->request('POST', '/graphql', $options->toArray());
530+ //
531+ // $this->assertResponseIsSuccessful();
532+ // $this->assertJsonEquals([
533+ // 'data' => [
534+ // 'backedEnumIntegerResources' => [
535+ // ['value' => 1],
536+ // ['value' => 2],
537+ // ['value' => 3],
538+ // ],
539+ // ],
540+ // ]);
541+ // }
542+
529543 public function testItemGraphQlInteger (): void
530544 {
531545 $ query = <<<'GRAPHQL'
@@ -551,18 +565,4 @@ public function testItemGraphQlInteger(): void
551565 ],
552566 ]);
553567 }
554-
555- public static function provider404s (): iterable
556- {
557- yield ['/backed_enum_integer_resources/42 ' ];
558- yield ['/backed_enum_integer_resources/fortytwo ' ];
559- }
560-
561- /** @dataProvider provider404s */
562- public function testItem404 (string $ uri ): void
563- {
564- self ::createClient ()->request ('GET ' , $ uri );
565-
566- $ this ->assertResponseStatusCodeSame (404 );
567- }
568568}
0 commit comments