@@ -55,32 +55,32 @@ public function testCreateFromRequest()
55
55
{
56
56
$ request = Request::create ('/foos/1 ' );
57
57
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_item_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
58
- $ expected = ['foo ' => 'bar ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
58
+ $ expected = ['foo ' => 'bar ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
59
59
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , true ));
60
60
61
61
$ request = Request::create ('/foos ' );
62
62
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_collection_operation_name ' => 'pot ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
63
- $ expected = ['foo ' => 'bar ' , 'collection_operation_name ' => 'pot ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
63
+ $ expected = ['foo ' => 'bar ' , 'collection_operation_name ' => 'pot ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
64
64
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , true ));
65
65
66
66
$ request = Request::create ('/foos/1 ' );
67
67
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_item_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
68
- $ expected = ['bar ' => 'baz ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
68
+ $ expected = ['bar ' => 'baz ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
69
69
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
70
70
71
71
$ request = Request::create ('/foos ' , 'POST ' );
72
72
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_collection_operation_name ' => 'post ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
73
- $ expected = ['bar ' => 'baz ' , 'collection_operation_name ' => 'post ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => false , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
73
+ $ expected = ['bar ' => 'baz ' , 'collection_operation_name ' => 'post ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => false , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
74
74
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
75
75
76
76
$ request = Request::create ('/foos ' , 'PUT ' );
77
77
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_collection_operation_name ' => 'put ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
78
- $ expected = ['bar ' => 'baz ' , 'collection_operation_name ' => 'put ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => true , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
78
+ $ expected = ['bar ' => 'baz ' , 'collection_operation_name ' => 'put ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos ' , 'api_allow_update ' => true , 'operation_type ' => 'collection ' , 'uri ' => 'http://localhost/foos ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
79
79
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
80
80
81
81
$ request = Request::create ('/bars/1/foos ' );
82
82
$ request ->attributes ->replace (['_api_resource_class ' => 'Foo ' , '_api_subresource_operation_name ' => 'get ' , '_api_format ' => 'xml ' , '_api_mime_type ' => 'text/xml ' ]);
83
- $ expected = ['bar ' => 'baz ' , 'subresource_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'operation_type ' => 'subresource ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
83
+ $ expected = ['bar ' => 'baz ' , 'subresource_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/bars/1/foos ' , 'operation_type ' => 'subresource ' , 'api_allow_update ' => false , 'uri ' => 'http://localhost/bars/1/foos ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
84
84
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest ($ request , false ));
85
85
}
86
86
@@ -93,7 +93,7 @@ public function testThrowExceptionOnInvalidRequest()
93
93
94
94
public function testReuseExistingAttributes ()
95
95
{
96
- $ expected = ['bar ' => 'baz ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'denormalize_resource_class ' => 'Foo ' , 'normalize_resource_class ' => 'Foo ' ];
96
+ $ expected = ['bar ' => 'baz ' , 'item_operation_name ' => 'get ' , 'resource_class ' => 'Foo ' , 'request_uri ' => '/foos/1 ' , 'api_allow_update ' => false , 'operation_type ' => 'item ' , 'uri ' => 'http://localhost/foos/1 ' , 'output_class ' => 'Foo ' , 'input_class ' => 'Foo ' ];
97
97
$ this ->assertEquals ($ expected , $ this ->builder ->createFromRequest (Request::create ('/foos/1 ' ), false , ['resource_class ' => 'Foo ' , 'item_operation_name ' => 'get ' ]));
98
98
}
99
99
}
0 commit comments