@@ -83,10 +83,10 @@ public function testEditPostWithUtf8Content()
83
83
{
84
84
$ utf8 = json_encode ('Hello world, Καλημέρα κόσμε, コンニチハ ' );
85
85
$ test = new Api ($ this );
86
- $ test ->put ('/posts/2 ' , '{"content": ' . $ utf8. '} ' );
86
+ $ test ->put ('/posts/2 ' , '{"content": ' . $ utf8 . '} ' );
87
87
$ test ->expect ('1 ' );
88
88
$ 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 . '} ' );
90
90
}
91
91
92
92
public function testEditPostWithUtf8ContentWithPost ()
@@ -95,10 +95,10 @@ public function testEditPostWithUtf8ContentWithPost()
95
95
$ url_encoded = urlencode ($ utf8 );
96
96
$ json_encoded = json_encode ($ utf8 );
97
97
$ test = new Api ($ this );
98
- $ test ->put ('/posts/2 ' , 'content= ' . $ url_encoded );
98
+ $ test ->put ('/posts/2 ' , 'content= ' . $ url_encoded );
99
99
$ test ->expect ('1 ' );
100
100
$ 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 . '} ' );
102
102
}
103
103
104
104
public function testDeletePost ()
@@ -138,9 +138,9 @@ public function testDeletePostWithPost()
138
138
public function testListWithPaginate ()
139
139
{
140
140
$ 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 );
144
144
}
145
145
$ test ->get ('/posts?page=2,2&order=id ' );
146
146
$ 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()
207
207
$ binary = base64_encode ("\0abc \0\n\r\b \0" );
208
208
$ base64url = rtrim (strtr ($ binary , '+/ ' , '-_ ' ), '= ' );
209
209
$ test = new Api ($ this );
210
- $ test ->put ('/categories/2 ' , '{"icon":" ' . $ base64url. '"} ' );
210
+ $ test ->put ('/categories/2 ' , '{"icon":" ' . $ base64url . '"} ' );
211
211
$ test ->expect ('1 ' );
212
212
$ test ->get ('/categories/2 ' );
213
- $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary. '"} ' );
213
+ $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary . '"} ' );
214
214
}
215
215
216
216
public function testEditCategoryWithNull ()
@@ -227,10 +227,10 @@ public function testEditCategoryWithBinaryContentWithPost()
227
227
$ binary = base64_encode ("€ \0abc \0\n\r\b \0" );
228
228
$ base64url = rtrim (strtr ($ binary , '+/ ' , '-_ ' ), '= ' );
229
229
$ test = new Api ($ this );
230
- $ test ->put ('/categories/2 ' , 'icon= ' . $ base64url );
230
+ $ test ->put ('/categories/2 ' , 'icon= ' . $ base64url );
231
231
$ test ->expect ('1 ' );
232
232
$ test ->get ('/categories/2 ' );
233
- $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary. '"} ' );
233
+ $ test ->expect ('{"id":2,"name":"article","icon":" ' . $ binary . '"} ' );
234
234
}
235
235
236
236
public function testListCategoriesWithBinaryContent ()
@@ -327,7 +327,7 @@ public function testEditUserLocation()
327
327
$ test ->put ('/users/1 ' , '{"location":"POINT(30 20)"} ' );
328
328
$ test ->expect ('1 ' );
329
329
$ test ->get ('/users/1?columns=id,location ' );
330
- if ($ this ->getEngineName ()== 'SQLServer ' ) {
330
+ if ($ this ->getEngineName () == 'SQLServer ' ) {
331
331
$ test ->expect ('{"id":1,"location":"POINT (30 20)"} ' );
332
332
} else {
333
333
$ test ->expect ('{"id":1,"location":"POINT(30 20)"} ' );
@@ -338,7 +338,7 @@ public function testListUserLocations()
338
338
{
339
339
$ test = new Api ($ this );
340
340
$ test ->get ('/users?columns=id,location ' );
341
- if ($ this ->getEngineName ()== 'SQLServer ' ) {
341
+ if ($ this ->getEngineName () == 'SQLServer ' ) {
342
342
$ test ->expect ('{"users":{"columns":["id","location"],"records":[[1,"POINT (30 20)"]]}} ' );
343
343
} else {
344
344
$ test ->expect ('{"users":{"columns":["id","location"],"records":[[1,"POINT(30 20)"]]}} ' );
@@ -347,7 +347,7 @@ public function testListUserLocations()
347
347
348
348
public function testEditUserWithId ()
349
349
{
350
- if ($ this ->getEngineName ()!= 'SQLServer ' ) {
350
+ if ($ this ->getEngineName () != 'SQLServer ' ) {
351
351
$ test = new Api ($ this );
352
352
$ test ->put ('/users/1 ' , '{"id":2,"password":"testtest2"} ' );
353
353
$ test ->expect ('1 ' );
@@ -634,7 +634,7 @@ public function testVarBinaryBarcodes()
634
634
$ test ->get ('/barcodes?transform=1 ' );
635
635
$ test ->expect ('{"barcodes":[{"id":1,"product_id":1,"hex":"00ff01","bin":"AP8B"}]} ' );
636
636
}
637
-
637
+
638
638
public function testEditPostWithApostrophe ()
639
639
{
640
640
$ test = new Api ($ this );
@@ -647,7 +647,7 @@ public function testEditPostWithApostrophe()
647
647
public function testAddPostWithLeadingWhitespaceInJSON ()
648
648
{
649
649
$ test = new Api ($ this );
650
- $ test ->post ('/posts ' , '
650
+ $ test ->post ('/posts ' , '
651
651
{"user_id":1,"category_id":1,"content":"test whitespace"} ' );
652
652
$ test ->expect ('21 ' );
653
653
$ test ->get ('/posts/21 ' );
@@ -682,15 +682,23 @@ public function testTenancyListColumns()
682
682
// should list only user with id=1 (exactly 1 record)
683
683
$ test = new Api ($ this );
684
684
$ 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
+ }
686
690
}
687
691
688
692
public function testTenancyListExclude ()
689
693
{
690
694
// should list only user with id=1 (exactly 1 record)
691
695
$ test = new Api ($ this );
692
696
$ 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
+ }
694
702
}
695
703
696
704
public function testTenancyReadColumns ()
0 commit comments