Skip to content

Commit 9be41e9

Browse files
committed
Add extra JSON test
1 parent 60ac51b commit 9be41e9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/tests.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)