@@ -83,10 +83,10 @@ public function testEditPostWithUtf8Content()
8383 {
8484 $ utf8 = json_encode ('Hello world, Καλημέρα κόσμε, コンニチハ ' );
8585 $ test = new Api ($ this );
86- $ test ->put ('/posts/2 ' , '{"content": ' . $ utf8. '} ' );
86+ $ test ->put ('/posts/2 ' , '{"content": ' . $ utf8 . '} ' );
8787 $ test ->expect ('1 ' );
8888 $ test ->get ('/posts/2 ' );
89- $ test ->expect ('{"id":2,"user_id":1,"category_id":2,"content": ' . $ utf8. '} ' );
89+ $ test ->expect ('{"id":2,"user_id":1,"category_id":2,"content": ' . $ utf8 . '} ' );
9090 }
9191
9292 public function testEditPostWithUtf8ContentWithPost ()
@@ -95,10 +95,10 @@ public function testEditPostWithUtf8ContentWithPost()
9595 $ url_encoded = urlencode ($ utf8 );
9696 $ json_encoded = json_encode ($ utf8 );
9797 $ test = new Api ($ this );
98- $ test ->put ('/posts/2 ' , 'content= ' . $ url_encoded );
98+ $ test ->put ('/posts/2 ' , 'content= ' . $ url_encoded );
9999 $ test ->expect ('1 ' );
100100 $ test ->get ('/posts/2 ' );
101- $ test ->expect ('{"id":2,"user_id":1,"category_id":2,"content": ' . $ json_encoded. '} ' );
101+ $ test ->expect ('{"id":2,"user_id":1,"category_id":2,"content": ' . $ json_encoded . '} ' );
102102 }
103103
104104 public function testDeletePost ()
@@ -138,9 +138,9 @@ public function testDeletePostWithPost()
138138 public function testListWithPaginate ()
139139 {
140140 $ test = new Api ($ this );
141- for ($ i= 1 ; $ i <= 10 ;$ i ++) {
142- $ test ->post ('/posts ' , '{"user_id":1,"category_id":1,"content":"# ' . $ i . '"} ' );
143- $ test ->expect (4 + $ i );
141+ for ($ i = 1 ; $ i <= 10 ; $ i ++) {
142+ $ test ->post ('/posts ' , '{"user_id":1,"category_id":1,"content":"# ' . $ i . '"} ' );
143+ $ test ->expect (4 + $ i );
144144 }
145145 $ test ->get ('/posts?page=2,2&order=id ' );
146146 $ test ->expect ('{"posts":{"columns":["id","user_id","category_id","content"],"records":[[5,1,1,"#1"],[6,1,1,"#2"]],"results":11}} ' );
@@ -207,10 +207,10 @@ public function testEditCategoryWithBinaryContent()
207207 $ binary = base64_encode ("\0abc \0\n\r\b \0" );
208208 $ base64url = rtrim (strtr ($ binary , '+/ ' , '-_ ' ), '= ' );
209209 $ test = new Api ($ this );
210- $ test ->put ('/categories/2 ' , '{"icon":" ' . $ base64url. '"} ' );
210+ $ test ->put ('/categories/2 ' , '{"icon":" ' . $ base64url . '"} ' );
211211 $ test ->expect ('1 ' );
212212 $ test ->get ('/categories/2 ' );
213- $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary. '"} ' );
213+ $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary . '"} ' );
214214 }
215215
216216 public function testEditCategoryWithNull ()
@@ -227,10 +227,10 @@ public function testEditCategoryWithBinaryContentWithPost()
227227 $ binary = base64_encode ("€ \0abc \0\n\r\b \0" );
228228 $ base64url = rtrim (strtr ($ binary , '+/ ' , '-_ ' ), '= ' );
229229 $ test = new Api ($ this );
230- $ test ->put ('/categories/2 ' , 'icon= ' . $ base64url );
230+ $ test ->put ('/categories/2 ' , 'icon= ' . $ base64url );
231231 $ test ->expect ('1 ' );
232232 $ test ->get ('/categories/2 ' );
233- $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary. '"} ' );
233+ $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary . '"} ' );
234234 }
235235
236236 public function testListCategoriesWithBinaryContent ()
@@ -327,7 +327,7 @@ public function testEditUserLocation()
327327 $ test ->put ('/users/1 ' , '{"location":"POINT(30 20)"} ' );
328328 $ test ->expect ('1 ' );
329329 $ test ->get ('/users/1?columns=id,location ' );
330- if ($ this ->getEngineName ()== 'SQLServer ' ) {
330+ if ($ this ->getEngineName () == 'SQLServer ' ) {
331331 $ test ->expect ('{"id":1,"location":"POINT (30 20)"} ' );
332332 } else {
333333 $ test ->expect ('{"id":1,"location":"POINT(30 20)"} ' );
@@ -338,7 +338,7 @@ public function testListUserLocations()
338338 {
339339 $ test = new Api ($ this );
340340 $ test ->get ('/users?columns=id,location ' );
341- if ($ this ->getEngineName ()== 'SQLServer ' ) {
341+ if ($ this ->getEngineName () == 'SQLServer ' ) {
342342 $ test ->expect ('{"users":{"columns":["id","location"],"records":[[1,"POINT (30 20)"]]}} ' );
343343 } else {
344344 $ test ->expect ('{"users":{"columns":["id","location"],"records":[[1,"POINT(30 20)"]]}} ' );
@@ -347,7 +347,7 @@ public function testListUserLocations()
347347
348348 public function testEditUserWithId ()
349349 {
350- if ($ this ->getEngineName ()!= 'SQLServer ' ) {
350+ if ($ this ->getEngineName () != 'SQLServer ' ) {
351351 $ test = new Api ($ this );
352352 $ test ->put ('/users/1 ' , '{"id":2,"password":"testtest2"} ' );
353353 $ test ->expect ('1 ' );
@@ -634,7 +634,7 @@ public function testVarBinaryBarcodes()
634634 $ test ->get ('/barcodes?transform=1 ' );
635635 $ test ->expect ('{"barcodes":[{"id":1,"product_id":1,"hex":"00ff01","bin":"AP8B"}]} ' );
636636 }
637-
637+
638638 public function testEditPostWithApostrophe ()
639639 {
640640 $ test = new Api ($ this );
@@ -647,7 +647,7 @@ public function testEditPostWithApostrophe()
647647 public function testAddPostWithLeadingWhitespaceInJSON ()
648648 {
649649 $ test = new Api ($ this );
650- $ test ->post ('/posts ' , '
650+ $ test ->post ('/posts ' , '
651651 {"user_id":1,"category_id":1,"content":"test whitespace"} ' );
652652 $ test ->expect ('21 ' );
653653 $ test ->get ('/posts/21 ' );
@@ -682,15 +682,23 @@ public function testTenancyListColumns()
682682 // should list only user with id=1 (exactly 1 record)
683683 $ test = new Api ($ this );
684684 $ test ->get ('/users?columns=username,location ' );
685- $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT(30 20)"]]}} ' );
685+ if ($ this ->getEngineName () == 'SQLServer ' ) {
686+ $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT (30 20)"]]}} ' );
687+ } else {
688+ $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT(30 20)"]]}} ' );
689+ }
686690 }
687691
688692 public function testTenancyListExclude ()
689693 {
690694 // should list only user with id=1 (exactly 1 record)
691695 $ test = new Api ($ this );
692696 $ test ->get ('/users?exclude=id ' );
693- $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT(30 20)"]]}} ' );
697+ if ($ this ->getEngineName () == 'SQLServer ' ) {
698+ $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT (30 20)"]]}} ' );
699+ } else {
700+ $ test ->expect ('{"users":{"columns":["username","location"],"records":[["user1","POINT(30 20)"]]}} ' );
701+ }
694702 }
695703
696704 public function testTenancyReadColumns ()
0 commit comments