@@ -67,42 +67,42 @@ public function testCreateFromRequest(): void
67
67
{
68
68
$ request = Request::create ('/foos/1 ' );
69
69
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
70
- $ expected = ['foo ' => 'bar ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
70
+ $ expected = ['foo ' => 'bar ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
71
71
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , true ));
72
72
73
73
$ request = Request::create ('/foos ' );
74
74
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'get_collection ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
75
- $ expected = ['foo ' => 'bar ' , 'operation_name ' => 'get_collection ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation ->withName ('get_collection ' ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
75
+ $ expected = ['foo ' => 'bar ' , 'operation_name ' => 'get_collection ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation ->withName ('get_collection ' ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
76
76
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , true ));
77
77
78
78
$ request = Request::create ('/foos/1 ' );
79
79
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
80
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
80
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
81
81
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
82
82
83
83
$ request = Request::create ('/foos ' , 'POST ' );
84
84
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'post ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
85
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'post ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation ->withName ('post ' ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
85
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'post ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation ->withName ('post ' ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
86
86
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
87
87
88
88
$ request = Request::create ('/foos ' , 'PUT ' );
89
89
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'put ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
90
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'put ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => true , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => (new Put (name: 'put ' ))->withOperation ($ this ->operation ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
90
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'put ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => true , 'uri ' => 'http://localhost/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => (new Put (name: 'put ' ))->withOperation ($ this ->operation ), 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
91
91
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
92
92
93
93
$ request = Request::create ('/bars/1/foos ' );
94
94
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
95
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
95
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
96
96
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
97
97
98
98
$ request = Request::create ('/foowithpatch/1 ' , 'PATCH ' );
99
99
$ request ->attributes ->replace (['_api_resource_class ' => 'FooWithPatch ' , '_api_operation_name ' => 'patch ' , '_api_format ' => 'json ' , '_api_mime_type ' => 'application/json ' ]);
100
- $ expected = ['operation_name ' => 'patch ' , 'resource_class ' => 'FooWithPatch ' , 'request_uri ' => '/foowithpatch/1 ' , 'api_allow_update ' => true , 'uri ' => 'http://localhost/foowithpatch/1 ' , 'output ' => null , 'input ' => null , 'deep_object_to_populate ' => true , 'skip_null_values ' => true , 'iri_only ' => false , 'operation ' => $ this ->patchOperation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
100
+ $ expected = ['operation_name ' => 'patch ' , 'resource_class ' => 'FooWithPatch ' , 'request_uri ' => '/foowithpatch/1 ' , 'api_allow_update ' => true , 'uri ' => 'http://localhost/foowithpatch/1 ' , 'output ' => null , 'input ' => null , 'deep_object_to_populate ' => true , 'skip_null_values ' => true , 'iri_only ' => false , 'operation ' => $ this ->patchOperation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
101
101
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
102
102
103
103
$ request = Request::create ('/bars/1/foos ' );
104
104
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' , 'id ' => '1 ' ]);
105
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'operation ' => $ this ->operation , 'skip_null_values ' => true , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
105
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'operation ' => $ this ->operation , 'skip_null_values ' => true , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
106
106
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
107
107
}
108
108
@@ -115,7 +115,7 @@ public function testThrowExceptionOnInvalidRequest(): void
115
115
116
116
public function testReuseExistingAttributes (): void
117
117
{
118
- $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => true ];
118
+ $ expected = ['bar ' => 'baz ' , 'operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/foos/1 ' , 'output ' => null , 'input ' => null , 'iri_only ' => false , 'skip_null_values ' => true , 'operation ' => $ this ->operation , 'exclude_from_cache_key ' => ['root_operation ' , 'operation ' ], 'skip_deprecated_exception_normalizers ' => false ];
119
119
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest (Request::create ('/foos/1 ' ), false , ['resource_class ' => 'Foo ' , 'operation_name ' => 'get ' ]));
120
120
}
121
121
0 commit comments