@@ -32,7 +32,7 @@ private function action($method,$url,$data='')
3232 'column_authorizer ' =>function ($ action ,$ database ,$ table ,$ column ) { return !($ column =='password ' &&$ action =='list ' ); },
3333 'record_filter ' =>function ($ action ,$ database ,$ table ) { return ($ table =='posts ' )?array ('id,neq,13 ' ):false ; },
3434 '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 ; },
3636 'input_validator ' =>function ($ action ,$ database ,$ table ,$ column ,$ type ,$ value ,$ context ) { return ($ column =='category_id ' && !is_numeric ($ value ))?'must be numeric ' :true ; },
3737 // for tests
3838 'method ' =>$ method ,
@@ -770,4 +770,13 @@ public function testReadProductProperties()
770770 $ test ->get ('/products/1?columns=id,properties ' );
771771 $ test ->expect ('{"id":1,"properties":{"depth":false,"model":"TRX-120","width":100,"height":null}} ' );
772772 }
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+ }
773782}
0 commit comments