@@ -32,7 +32,7 @@ private function action($method,$url,$data='')
32
32
'column_authorizer ' =>function ($ action ,$ database ,$ table ,$ column ) { return !($ column =='password ' &&$ action =='list ' ); },
33
33
'record_filter ' =>function ($ action ,$ database ,$ table ) { return ($ table =='posts ' )?array ('id,neq,13 ' ):false ; },
34
34
'tenancy_function ' =>function ($ action ,$ database ,$ table ,$ column ) { return ($ table =='users ' &&$ column =='id ' )?1 :null ; },
35
- 'input_sanitizer ' =>function ($ action ,$ database ,$ table ,$ column ,$ type ,$ value ) { return $ value=== null ? null : strip_tags ($ value ); },
35
+ 'input_sanitizer ' =>function ($ action ,$ database ,$ table ,$ column ,$ type ,$ value ) { return is_string ( $ value)? strip_tags ($ value ): $ value ; },
36
36
'input_validator ' =>function ($ action ,$ database ,$ table ,$ column ,$ type ,$ value ,$ context ) { return ($ column =='category_id ' && !is_numeric ($ value ))?'must be numeric ' :true ; },
37
37
// for tests
38
38
'method ' =>$ method ,
@@ -770,4 +770,13 @@ public function testReadProductProperties()
770
770
$ test ->get ('/products/1?columns=id,properties ' );
771
771
$ test ->expect ('{"id":1,"properties":{"depth":false,"model":"TRX-120","width":100,"height":null}} ' );
772
772
}
773
+
774
+ public function testWriteProductProperties ()
775
+ {
776
+ $ test = new API ($ this );
777
+ $ test ->put ('/products/1 ' ,'{"properties":{"depth":false,"model":"TRX-120","width":100,"height":123}} ' );
778
+ $ test ->expect ('1 ' );
779
+ $ test ->get ('/products/1?columns=id,properties ' );
780
+ $ test ->expect ('{"id":1,"properties":{"depth":false,"model":"TRX-120","width":100,"height":123}} ' );
781
+ }
773
782
}
0 commit comments