]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
b30da447c30986c5eef47801ba26ac29d267e25a
[friendica.git] / tests / datasets / api.fixture.php
1 <?php
2 /**
3  * @copyright Copyright (C) 2020, Friendica
4  *
5  * @license GNU AGPL version 3 or any later version
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Affero General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  *
20  */
21
22 use Friendica\Core\Protocol;
23 use Friendica\Model\Contact;
24 use Friendica\Model\Item;
25 use Friendica\Model\Notification;
26
27 return [
28         // Empty these tables
29         'cache',
30         'conversation',
31         'pconfig',
32         'photo',
33         'workerqueue',
34         'mail',
35         'post-delivery-data',
36         // Base test config to avoid notice messages
37         'config'  => [
38                 [
39                         'cat' => 'system',
40                         'k'   => 'url',
41                         'v'   => 'http://localhost',
42                 ],
43                 [
44                         'cat' => 'config',
45                         'k'   => 'hostname',
46                         'v'   => 'localhost',
47                 ],
48                 [
49                         'cat' => 'system',
50                         'k'   => 'worker_dont_fork',
51                         'v'   => '1',
52                 ],
53         ],
54         'user'    => [
55                 [
56                         'uid'      => 42,
57                         'username' => 'Test user',
58                         'nickname' => 'selfcontact',
59                         'verified' => 1,
60                         'password' => '$2y$10$DLRNTRmJgKe1cSrFJ5Jb0edCqvXlA9sh/RHdSnfxjbR.04yZRm4Qm',
61                         'theme'    => 'frio',
62                 ],
63         ],
64         'contact' => [
65                 [
66                         'id'      => 42,
67                         'uid'     => 42,
68                         'name'    => 'Self contact',
69                         'nick'    => 'selfcontact',
70                         'self'    => 1,
71                         'nurl'    => 'http://localhost/profile/selfcontact',
72                         'url'     => 'http://localhost/profile/selfcontact',
73                         'about'   => 'User used in tests',
74                         'pending' => 0,
75                         'blocked' => 0,
76                         'rel'     => Contact::FOLLOWER,
77                         'network' => Protocol::DFRN,
78                         'location' => 'DFRN',
79                 ],
80                 // Having the same name and nick allows us to test
81                 // the fallback to api_get_nick() in api_get_user()
82                 [
83                         'id'      => 43,
84                         'uid'     => 0,
85                         'name'    => 'othercontact',
86                         'nick'    => 'othercontact',
87                         'self'    => 0,
88                         'nurl'    => 'http://localhost/profile/othercontact',
89                         'url'     => 'http://localhost/profile/othercontact',
90                         'pending' => 0,
91                         'blocked' => 0,
92                         'rel'     => Contact::NOTHING,
93                         'network' => Protocol::DFRN, 
94                         'location' => 'DFRN',
95                 ],
96                 [
97                         'id'      => 44,
98                         'uid'     => 42,
99                         'name'    => 'Friend contact',
100                         'nick'    => 'friendcontact',
101                         'self'    => 0,
102                         'nurl'    => 'http://localhost/profile/friendcontact',
103                         'url'     => 'http://localhost/profile/friendcontact',
104                         'pending' => 0,
105                         'blocked' => 0,
106                         'rel'     => Contact::SHARING,
107                         'network' => Protocol::DFRN,
108                         'location' => 'DFRN',
109                 ],
110                 [
111                         'id'      => 45,
112                         'uid'     => 0,
113                         'name'    => 'Friend contact',
114                         'nick'    => 'friendcontact',
115                         'self'    => 0,
116                         'nurl'    => 'http://localhost/profile/friendcontact',
117                         'url'     => 'http://localhost/profile/friendcontact',
118                         'pending' => 0,
119                         'blocked' => 0,
120                         'rel'     => Contact::SHARING,
121                         'network' => Protocol::DFRN,
122                         'location' => 'DFRN',
123                 ],
124                 [
125                         'id'      => 46,
126                         'uid'     => 42,
127                         'name'    => 'Mutual contact',
128                         'nick'    => 'mutualcontact',
129                         'self'    => 0,
130                         'nurl'    => 'http://localhost/profile/mutualcontact',
131                         'url'     => 'http://localhost/profile/mutualcontact',
132                         'pending' => 0,
133                         'blocked' => 0,
134                         'rel'     => Contact::FRIEND,
135                         'network' => Protocol::DFRN,
136                         'location' => 'DFRN',
137                 ],
138                 [
139                         'id'      => 47,
140                         'uid'     => 0,
141                         'name'    => 'Mutual contact',
142                         'nick'    => 'mutualcontact',
143                         'self'    => 0,
144                         'nurl'    => 'http://localhost/profile/mutualcontact',
145                         'url'     => 'http://localhost/profile/mutualcontact',
146                         'pending' => 0,
147                         'blocked' => 0,
148                         'rel'     => Contact::SHARING,
149                         'network' => Protocol::DFRN,
150                         'location' => 'DFRN',
151                 ],
152         ],
153         'item-uri'    => [
154                 [
155                         'id'   => 1,
156                         'uri'  => '1',
157                         'guid' => '1',
158                 ],
159                 [
160                         'id'   => 2,
161                         'uri'  => '2',
162                         'guid' => '2',
163                 ],
164                 [
165                         'id'   => 3,
166                         'uri'  => '3',
167                         'guid' => '3',
168                 ],
169                 [
170                         'id'   => 4,
171                         'uri'  => '4',
172                         'guid' => '4',
173                 ],
174                 [
175                         'id'   => 5,
176                         'uri'  => '5',
177                         'guid' => '5',
178                 ],
179                 [
180                         'id'   => 6,
181                         'uri'  => '6',
182                         'guid' => '6',
183                 ],
184         ],
185         'post-content' => [
186                 [
187                         'uri-id' => 1,
188                         'body'   => 'Parent status',
189                         'plink'  => 'http://localhost/display/1',
190                 ],
191                 [
192                         'uri-id' => 2,
193                         'body'   => 'Reply',
194                         'plink'  => 'http://localhost/display/2',
195                 ],
196                 [
197                         'uri-id' => 3,
198                         'body'   => 'Other user status',
199                         'plink'  => 'http://localhost/display/3',
200                 ],
201                 [
202                         'uri-id' => 4,
203                         'body'   => 'Friend user reply',
204                         'plink'  => 'http://localhost/display/4',
205                 ],
206                 [
207                         'uri-id' => 5,
208                         'body'   => '[share]Shared status[/share]',
209                         'plink'  => 'http://localhost/display/5',
210                 ],
211                 [
212                         'uri-id' => 6,
213                         'body'   => 'Friend user status',
214                         'plink'  => 'http://localhost/display/6',
215                 ],
216         ],
217         'post-thread'  => [
218                 [
219                         'uri-id'     => 1,
220                         'author-id'  => 42,
221                         'owner-id'   => 42,
222                         'causer-id'  => 42,
223                         'network' => Protocol::DFRN,
224                 ],
225                 [
226                         'uri-id'     => 3,
227                         'author-id'  => 43,
228                         'owner-id'   => 43,
229                         'causer-id'  => 43,
230                         'network' => Protocol::DFRN,
231                 ],
232                 [
233                         'uri-id'     => 6,
234                         'author-id'  => 44,
235                         'owner-id'   => 44,
236                         'causer-id'  => 44,
237                         'network' => Protocol::DFRN,
238                 ],
239         ],
240         'post-thread-user'  => [
241                 [
242                         'uri-id'     => 1,
243                         'uid'        => 42,
244                         'wall'       => 1,
245                 ],
246                 [
247                         'uri-id'     => 3,
248                         'uid'        => 42,
249                         'wall'       => 1,
250                 ],
251                 [
252                         'uri-id'     => 6,
253                         'uid'        => 42,
254                         'wall'       => 1,
255                 ],
256                 [
257                         'uri-id'     => 1,
258                         'uid'        => 0,
259                         'wall'       => 0,
260                 ],
261                 [
262                         'uri-id'     => 3,
263                         'uid'        => 0,
264                         'wall'       => 0,
265                 ],
266                 [
267                         'uri-id'     => 6,
268                         'uid'        => 0,
269                         'wall'       => 0,
270                 ],
271         ],
272         'post-user' => [
273                 [
274                         'id'          => 1,
275                         'uri-id'      => 1,
276                         'uid'         => 42,
277                         'contact-id'  => 42,
278                         'unseen'      => 1,
279                         'origin'      => 1,
280                 ],
281                 [
282                         'id'          => 2,
283                         'uri-id'      => 2,
284                         'uid'         => 42,
285                         'contact-id'  => 42,
286                         'unseen'      => 0,
287                         'origin'      => 1,
288                 ],
289                 [
290                         'id'          => 3,
291                         'uri-id'      => 3,
292                         'uid'         => 42,
293                         'contact-id'  => 43,
294                         'unseen'      => 0,
295                         'origin'      => 1,
296                 ],
297                 [
298                         'id'          => 4,
299                         'uri-id'      => 4,
300                         'uid'         => 42,
301                         'contact-id'  => 44,
302                         'unseen'      => 0,
303                         'origin'      => 1,
304                 ],
305                 [
306                         'id'          => 5,
307                         'uri-id'      => 5,
308                         'uid'         => 42,
309                         'contact-id'  => 42,
310                         'unseen'      => 0,
311                         'origin'      => 1,
312                 ],
313                 [
314                         'id'          => 6,
315                         'uri-id'      => 6,
316                         'uid'         => 42,
317                         'contact-id'  => 44,
318                         'unseen'      => 0,
319                         'origin'      => 1,
320                 ],
321                 [
322                         'id'          => 7,
323                         'uri-id'      => 1,
324                         'uid'         => 0,
325                         'contact-id'  => 42,
326                         'unseen'      => 1,
327                         'origin'      => 0,
328                 ],
329                 [
330                         'id'          => 8,
331                         'uri-id'      => 2,
332                         'uid'         => 0,
333                         'contact-id'  => 42,
334                         'unseen'      => 0,
335                         'origin'      => 0,
336                 ],
337                 [
338                         'id'          => 9,
339                         'uri-id'      => 3,
340                         'uid'         => 0,
341                         'contact-id'  => 43,
342                         'unseen'      => 0,
343                         'origin'      => 0,
344                 ],
345                 [
346                         'id'          => 10,
347                         'uri-id'      => 4,
348                         'uid'         => 0,
349                         'contact-id'  => 44,
350                         'unseen'      => 0,
351                         'origin'      => 0,
352                 ],
353                 [
354                         'id'          => 11,
355                         'uri-id'      => 5,
356                         'uid'         => 0,
357                         'contact-id'  => 42,
358                         'unseen'      => 0,
359                         'origin'      => 0,
360                 ],
361                 [
362                         'id'          => 12,
363                         'uri-id'      => 6,
364                         'uid'         => 0,
365                         'contact-id'  => 44,
366                         'unseen'      => 0,
367                         'origin'      => 0,
368                 ],
369
370         ],
371         'item'    => [
372                 [
373                         'id'          => 1,
374                         'uri-id'      => 1,
375                         'uri'         => '1',
376                         'visible'     => 1,
377                         'contact-id'  => 42,
378                         'author-id'   => 42,
379                         'owner-id'    => 42,
380                         'causer-id'   => 42,
381                         'uid'         => 42,
382                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
383                         'unseen'      => 1,
384                         'parent'      => 1,
385                         'parent-uri-id' => 1,
386                         'parent-uri'  => '1',
387                         'thr-parent-id' => 1,
388                         'thr-parent'  => '1',
389                         'private'     => Item::PUBLIC,
390                         'gravity'     => GRAVITY_PARENT,
391                         'author-link' => 'http://localhost/profile/selfcontact',
392                         'wall'        => 1,
393                         'starred'     => 1,
394                         'origin'      => 1,
395                         'allow_cid'   => '',
396                         'allow_gid'   => '',
397                         'deny_cid'    => '',
398                         'deny_gid'    => '',
399                         'guid'        => '1',
400                 ],
401                 [
402                         'id'          => 2,
403                         'uri-id'      => 2,
404                         'uri'         => '2',
405                         'visible'     => 1,
406                         'contact-id'  => 42,
407                         'author-id'   => 42,
408                         'owner-id'    => 42,
409                         'causer-id'   => 42,
410                         'uid'         => 42,
411                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
412                         'unseen'      => 0,
413                         'parent'      => 1,
414                         'parent-uri-id' => 1,
415                         'parent-uri'  => '1',
416                         'thr-parent-id' => 1,
417                         'thr-parent'  => '1',
418                         'private'     => Item::PUBLIC,
419                         'gravity'     => GRAVITY_COMMENT,
420                         'author-link' => 'http://localhost/profile/selfcontact',
421                         'wall'        => 1,
422                         'starred'     => 0,
423                         'origin'      => 1,
424                         'guid'        => '2',
425                 ],
426                 [
427                         'id'          => 3,
428                         'uri-id'      => 3,
429                         'uri'         => '3',
430                         'visible'     => 1,
431                         'contact-id'  => 43,
432                         'author-id'   => 43,
433                         'owner-id'    => 42,
434                         'causer-id'   => 43,
435                         'uid'         => 42,
436                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
437                         'unseen'      => 0,
438                         'parent'      => 3,
439                         'parent-uri-id' => 3,
440                         'parent-uri'  => '3',
441                         'thr-parent-id' => 3,
442                         'thr-parent'  => '3',
443                         'private'     => Item::PUBLIC,
444                         'gravity'     => GRAVITY_PARENT,
445                         'author-link' => 'http://localhost/profile/othercontact',
446                         'wall'        => 1,
447                         'starred'     => 0,
448                         'origin'      => 1,
449                         'guid'        => '3',
450                 ],
451                 [
452                         'id'          => 4,
453                         'uri-id'      => 4,
454                         'uri'         => '4',
455                         'visible'     => 1,
456                         'contact-id'  => 44,
457                         'author-id'   => 44,
458                         'owner-id'    => 42,
459                         'causer-id'   => 44,
460                         'uid'         => 42,
461                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
462                         'unseen'      => 0,
463                         'body'        => 'Friend user reply',
464                         'parent'      => 1,
465                         'parent-uri-id' => 1,
466                         'parent-uri'  => '1',
467                         'thr-parent-id' => 1,
468                         'thr-parent'  => '1',
469                         'private'     => Item::PUBLIC,
470                         'gravity'     => GRAVITY_COMMENT,
471                         'author-link' => 'http://localhost/profile/othercontact',
472                         'wall'        => 1,
473                         'starred'     => 0,
474                         'origin'      => 1,
475                         'guid'        => '4',
476                 ],
477                 [
478
479                         'id'          => 5,
480                         'uri-id'      => 5,
481                         'uri'         => '5',
482                         'visible'     => 1,
483                         'contact-id'  => 42,
484                         'author-id'   => 42,
485                         'owner-id'    => 42,
486                         'causer-id'   => 42,
487                         'uid'         => 42,
488                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
489                         'unseen'      => 0,
490                         'parent'      => 1,
491                         'parent-uri-id' => 1,
492                         'parent-uri'  => '1',
493                         'thr-parent-id' => 1,
494                         'thr-parent'  => '1',
495                         'private'     => Item::PUBLIC,
496                         'gravity'     => GRAVITY_COMMENT,
497                         'author-link' => 'http://localhost/profile/othercontact',
498                         'wall'        => 1,
499                         'starred'     => 0,
500                         'origin'      => 1,
501                         'allow_cid'   => '',
502                         'allow_gid'   => '',
503                         'deny_cid'    => '',
504                         'deny_gid'    => '',
505                         'guid'        => '5',
506                 ],
507                 [
508                         'id'          => 6,
509                         'uri-id'      => 6,
510                         'uri'         => '6',
511                         'visible'     => 1,
512                         'contact-id'  => 44,
513                         'author-id'   => 44,
514                         'owner-id'    => 42,
515                         'causer-id'   => 44,
516                         'uid'         => 42,
517                         'verb'        => 'http://activitystrea.ms/schema/1.0/post',
518                         'unseen'      => 0,
519                         'parent'      => 6,
520                         'parent-uri-id' => 6,
521                         'parent-uri'  => '6',
522                         'thr-parent-id' => 6,
523                         'thr-parent'  => '6',
524                         'private'     => Item::PUBLIC,
525                         'gravity'     => GRAVITY_PARENT,
526                         'author-link' => 'http://localhost/profile/othercontact',
527                         'wall'        => 1,
528                         'starred'     => 0,
529                         'origin'      => 1,
530                         'guid'        => '6',
531                 ],
532         ],
533         'notify' => [
534                 [
535                         'id' => 1,
536                         'type' => 8,
537                         'name' => 'Reply to',
538                         'url' => 'http://localhost/display/1',
539                         'photo' => 'http://localhost/',
540                         'date' => '2020-01-01 12:12:02',
541                         'msg' => 'A test reply from an item',
542                         'uid' => 42,
543                         'link' => 'http://localhost/notification/1',
544                         'iid' => 4,
545                         'seen' => 0,
546                         'verb' => '',
547                         'otype' => Notification\ObjectType::ITEM,
548                         'name_cache' => 'Reply to',
549                         'msg_cache' => 'A test reply from an item',
550                 ],
551         ],
552         'profile' => [
553                 [
554                         'id' => 1,
555                         'uid' => 42,
556                 ],
557         ],
558         'group'   => [
559                 [
560                         'id'      => 1,
561                         'uid'     => 42,
562                         'visible' => 1,
563                         'name'    => 'Visible list',
564                 ],
565                 [
566                         'id'      => 2,
567                         'uid'     => 42,
568                         'visible' => 0,
569                         'name'    => 'Private list',
570                 ],
571         ],
572         'search'  => [
573                 [
574                         'id'   => 1,
575                         'term' => 'Saved search',
576                         'uid'  => 42,
577                 ],
578         ],
579 ];