Skip to content

Commit 6fc8dfa

Browse files
committed
src,tests: added standard response for API_ImportFromCSV, updated tests to work with new app
1 parent c1e8c45 commit 6fc8dfa

File tree

8 files changed

+49
-79
lines changed

8 files changed

+49
-79
lines changed

quickbase.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,35 @@ final public static function API_GrantedDBs(&$query, &$results){
888888

889889
// final public static function API_GrantedDBsForGroup(&$query, &$results){ }
890890
// final public static function API_GrantedGroups(&$query, &$results){ }
891-
// final public static function API_ImportFromCSV(&$query, &$results){ }
891+
892+
final public static function API_ImportFromCSV(&$query, &$results){
893+
if(isset($results['rids'])){
894+
if(isset($results['rids']['fields'])){
895+
$results['rids'] = array_map(function($record){
896+
foreach($record['field'] as $field){
897+
$record[$field['id']] = $field['_'];
898+
}
899+
900+
unset($record['field']);
901+
902+
return $record;
903+
}, $results['rids']['fields']);
904+
}else{
905+
$results['rids'] = array_map(function($record){
906+
$ret = array(
907+
'rid' => $record['_']
908+
);
909+
910+
if(isset($record['update_id'])){
911+
$ret['update_id'] = $record['update_id'];
912+
}
913+
914+
return $ret;
915+
}, $results['rids']);
916+
}
917+
}
918+
}
919+
892920
// final public static function API_ProvisionUser(&$query, &$results){ }
893921
// final public static function API_PurgeRecords(&$query, &$results){ }
894922
// final public static function API_RemoveGroupFromRole(&$query, &$results){ }

tests/API_DoQuery.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@
3333
'next_field_id' => 0,
3434
'next_query_id' => 0,
3535
'def_sort_fid' => 0,
36-
'def_sort_order' => 0
36+
'def_sort_order' => 0,
37+
'key_fid' => 0,
38+
'single_record_name' => '',
39+
'plural_record_name' => ''
3740
),
3841
'variables' => array(
3942
'test' => 'test'
4043
),
4144
'queries' => array(
4245
array(
4346
'id' => 1,
44-
'qycalst' => 0,
47+
'qycalst' => '',
4548
'qyopts' => 'nos.',
4649
'qytype' => 'table',
4750
'qyname' => 'List All'
4851
), array(
4952
'id' => 2,
50-
'qycalst' => 0,
53+
'qycalst' => '',
5154
'qyopts' => 'so-D.onlynew.nos.',
5255
'qytype' => 'table',
5356
'qyname' => 'List Changes',

tests/API_FindDBByName.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/* Main */
2727
$actual = $qb->api('API_FindDBByName', array(
28-
'dbname' => 'Tristian\'s Application'
28+
'dbname' => 'QuickBase Lib Test Application'
2929
));
3030

3131
if(!objStrctMatch($actual, $expected)){

tests/API_GetAppDTMInfo.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@
2727
'id' => ''
2828
),
2929
'tables' => array(
30-
array(
31-
'lastModifiedTime' => 0,
32-
'lastRecModTime' => 0,
33-
'id' => ''
34-
),
35-
array(
36-
'lastModifiedTime' => 0,
37-
'lastRecModTime' => 0,
38-
'id' => ''
39-
),
4030
array(
4131
'lastModifiedTime' => 0,
4232
'lastRecModTime' => 0,

tests/API_GetDBPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
$actual = $qb->api('API_GetDBPage', array(
2626
'dbid' => getenv('appid'),
27-
'pageID' => 2
27+
'pageID' => 9
2828
));
2929

3030
if(!objStrctMatch($actual, $expected)){

tests/API_GetSchema.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@
3333
'next_field_id' => 0,
3434
'next_query_id' => 0,
3535
'def_sort_fid' => 0,
36-
'def_sort_order' => 0
36+
'def_sort_order' => 0,
37+
'key_fid' => 0,
38+
'single_record_name' => '',
39+
'plural_record_name' => ''
3740
),
3841
'variables' => array(
3942
'test' => ''
4043
),
4144
'queries' => array(
4245
array(
4346
'id' => 1,
44-
'qycalst' => 0,
47+
'qycalst' => '',
4548
'qyopts' => 'nos.',
4649
'qytype' => 'table',
4750
'qyname' => 'List All'
4851
), array(
4952
'id' => 2,
50-
'qycalst' => 0,
53+
'qycalst' => '',
5154
'qyopts' => 'so-D.onlynew.nos.',
5255
'qytype' => 'table',
5356
'qyname' => 'List Changes',

tests/API_UserRoles.php

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -20,63 +20,6 @@
2020
'errcode' => 0,
2121
'errtext' => 'No error',
2222
'users' => array(
23-
array(
24-
'name' => '',
25-
'lastAccess' => 0,
26-
'lastAccessAppLocal' => '',
27-
'firstName' => '',
28-
'lastName' => '',
29-
'roles' => array(
30-
array(
31-
'name' => '',
32-
'access' => array(
33-
'name' => '',
34-
'id' => 0
35-
),
36-
'id' => 0
37-
)
38-
),
39-
'type' => '',
40-
'id' => ''
41-
),
42-
array(
43-
'name' => '',
44-
'lastAccess' => 0,
45-
'lastAccessAppLocal' => '',
46-
'firstName' => '',
47-
'lastName' => '',
48-
'roles' => array(
49-
array(
50-
'name' => '',
51-
'access' => array(
52-
'name' => '',
53-
'id' => 0
54-
),
55-
'id' => 0
56-
)
57-
),
58-
'type' => '',
59-
'id' => ''
60-
),
61-
array(
62-
'name' => '',
63-
'lastAccess' => 0,
64-
'lastAccessAppLocal' => '',
65-
'firstName' => '',
66-
'lastName' => '',
67-
'roles' => array(
68-
array(
69-
'name' => '',
70-
'access' => array(
71-
'name' => '',
72-
'id' => 0
73-
),
74-
'id' => 0
75-
)
76-
),
77-
'type' => '',
78-
'id' => ''
79-
),
8023
array(
8124
'name' => '',
8225
'lastAccess' => 0,

tests/curl_multi.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,24 @@
3333
'next_field_id' => 0,
3434
'next_query_id' => 0,
3535
'def_sort_fid' => 0,
36-
'def_sort_order' => 0
36+
'def_sort_order' => 0,
37+
'key_fid' => 0,
38+
'single_record_name' => '',
39+
'plural_record_name' => ''
3740
),
3841
'variables' => array(
3942
'test' => 'test'
4043
),
4144
'queries' => array(
4245
array(
4346
'id' => 1,
44-
'qycalst' => 0,
47+
'qycalst' => '',
4548
'qyopts' => 'nos.',
4649
'qytype' => 'table',
4750
'qyname' => 'List All'
4851
), array(
4952
'id' => 2,
50-
'qycalst' => 0,
53+
'qycalst' => '',
5154
'qyopts' => 'so-D.onlynew.nos.',
5255
'qytype' => 'table',
5356
'qyname' => 'List Changes',

0 commit comments

Comments
 (0)