]> git.mxchange.org Git - friendica.git/blob - tests/datasets/api.fixture.php
More test data
[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                         'cat' => 'system',
55                         'k'   => 'curl_timeout',
56                         'v'   => '1',
57                 ],
58                 [
59                         'cat' => 'system',
60                         'k'   => 'xrd_timeout',
61                         'v'   => '1',
62                 ],
63         ],
64         'user'    => [
65                 [
66                         'uid'      => 42,
67                         'username' => 'Test user',
68                         'nickname' => 'selfcontact',
69                         'verified' => 1,
70                         'password' => '$2y$10$DLRNTRmJgKe1cSrFJ5Jb0edCqvXlA9sh/RHdSnfxjbR.04yZRm4Qm',
71                         'theme'    => 'frio',
72                 ],
73         ],
74         'contact' => [
75                 [
76                         'id'      => 42,
77                         'uid'     => 42,
78                         'name'    => 'Self contact',
79                         'nick'    => 'selfcontact',
80                         'self'    => 1,
81                         'nurl'    => 'http://localhost/profile/selfcontact',
82                         'url'     => 'http://localhost/profile/selfcontact',
83                         'about'   => 'User used in tests',
84                         'pending' => 0,
85                         'blocked' => 0,
86                         'rel'     => Contact::FOLLOWER,
87                         'network' => Protocol::DFRN,
88                         'location' => 'DFRN',
89                 ],
90                 // Having the same name and nick allows us to test
91                 // the fallback to api_get_nick() in api_get_user()
92                 [
93                         'id'      => 43,
94                         'uid'     => 0,
95                         'name'    => 'othercontact',
96                         'nick'    => 'othercontact',
97                         'self'    => 0,
98                         'nurl'    => 'http://localhost/profile/othercontact',
99                         'url'     => 'http://localhost/profile/othercontact',
100                         'pending' => 0,
101                         'blocked' => 0,
102                         'rel'     => Contact::NOTHING,
103                         'network' => Protocol::DFRN, 
104                         'location' => 'DFRN',
105                 ],
106                 [
107                         'id'      => 44,
108                         'uid'     => 42,
109                         'name'    => 'Friend contact',
110                         'nick'    => 'friendcontact',
111                         'self'    => 0,
112                         'nurl'    => 'http://localhost/profile/friendcontact',
113                         'url'     => 'http://localhost/profile/friendcontact',
114                         'pending' => 0,
115                         'blocked' => 0,
116                         'rel'     => Contact::SHARING,
117                         'network' => Protocol::DFRN,
118                         'location' => 'DFRN',
119                 ],
120                 [
121                         'id'      => 45,
122                         'uid'     => 0,
123                         'name'    => 'Friend contact',
124                         'nick'    => 'friendcontact',
125                         'self'    => 0,
126                         'nurl'    => 'http://localhost/profile/friendcontact',
127                         'url'     => 'http://localhost/profile/friendcontact',
128                         'pending' => 0,
129                         'blocked' => 0,
130                         'rel'     => Contact::SHARING,
131                         'network' => Protocol::DFRN,
132                         'location' => 'DFRN',
133                 ],
134                 [
135                         'id'      => 46,
136                         'uid'     => 42,
137                         'name'    => 'Mutual contact',
138                         'nick'    => 'mutualcontact',
139                         'self'    => 0,
140                         'nurl'    => 'http://localhost/profile/mutualcontact',
141                         'url'     => 'http://localhost/profile/mutualcontact',
142                         'pending' => 0,
143                         'blocked' => 0,
144                         'rel'     => Contact::FRIEND,
145                         'network' => Protocol::DFRN,
146                         'location' => 'DFRN',
147                 ],
148                 [
149                         'id'      => 47,
150                         'uid'     => 0,
151                         'name'    => 'Mutual contact',
152                         'nick'    => 'mutualcontact',
153                         'self'    => 0,
154                         'nurl'    => 'http://localhost/profile/mutualcontact',
155                         'url'     => 'http://localhost/profile/mutualcontact',
156                         'pending' => 0,
157                         'blocked' => 0,
158                         'rel'     => Contact::SHARING,
159                         'network' => Protocol::DFRN,
160                         'location' => 'DFRN',
161                 ],
162         ],
163         'item-uri'    => [
164                 [
165                         'id'   => 1,
166                         'uri'  => '1',
167                         'guid' => '1',
168                 ],
169                 [
170                         'id'   => 2,
171                         'uri'  => '2',
172                         'guid' => '2',
173                 ],
174                 [
175                         'id'   => 3,
176                         'uri'  => '3',
177                         'guid' => '3',
178                 ],
179                 [
180                         'id'   => 4,
181                         'uri'  => '4',
182                         'guid' => '4',
183                 ],
184                 [
185                         'id'   => 5,
186                         'uri'  => '5',
187                         'guid' => '5',
188                 ],
189                 [
190                         'id'   => 6,
191                         'uri'  => '6',
192                         'guid' => '6',
193                 ],
194         ],
195         'verb'    => [
196                 [
197                         'id'   => 0,
198                         'name' => '',
199                 ],
200                 [
201                         'id'   => 1,
202                         'name' => 'http://activitystrea.ms/schema/1.0/like',
203                 ],
204                 [
205                         'id'   => 2,
206                         'name' => 'http://purl.org/macgirvin/dfrn/1.0/dislike',
207                 ],
208                 [
209                         'id'   => 3,
210                         'name' => 'http://purl.org/zot/activity/attendyes',
211                 ],
212                 [
213                         'id'   => 4,
214                         'name' => 'http://purl.org/zot/activity/attendno',
215                 ],
216                 [
217                         'id'   => 5,
218                         'name' => 'http://purl.org/zot/activity/attendmaybe',
219                 ],
220                 [
221                         'id'   => 6,
222                         'name' => 'http://activitystrea.ms/schema/1.0/follow',
223                 ],
224                 [
225                         'id'   => 7,
226                         'name' => 'https://www.w3.org/ns/activitystreams#Announce',
227                 ],
228                 [
229                         'id'   => 8,
230                         'name' => 'http://activitystrea.ms/schema/1.0/post',
231                 ],
232         ],
233         'post-content' => [
234                 [
235                         'uri-id' => 1,
236                         'body'   => 'Parent status',
237                         'plink'  => 'http://localhost/display/1',
238                 ],
239                 [
240                         'uri-id' => 2,
241                         'body'   => 'Reply',
242                         'plink'  => 'http://localhost/display/2',
243                 ],
244                 [
245                         'uri-id' => 3,
246                         'body'   => 'Other user status',
247                         'plink'  => 'http://localhost/display/3',
248                 ],
249                 [
250                         'uri-id' => 4,
251                         'body'   => 'Friend user reply',
252                         'plink'  => 'http://localhost/display/4',
253                 ],
254                 [
255                         'uri-id' => 5,
256                         'body'   => '[share]Shared status[/share]',
257                         'plink'  => 'http://localhost/display/5',
258                 ],
259                 [
260                         'uri-id' => 6,
261                         'body'   => 'Friend user status',
262                         'plink'  => 'http://localhost/display/6',
263                 ],
264         ],
265         'post'    => [
266                 [
267                         'uri-id'        => 1,
268                         'parent-uri-id' => 1,
269                         'thr-parent-id' => 1,
270                         'gravity'       => GRAVITY_PARENT,
271                         'network'       => Protocol::DFRN,
272                         'owner-id'      => 42,
273                         'author-id'     => 42,
274                         'causer-id'     => 42,
275                         'vid'           => 8,
276                         'private'       => Item::PUBLIC,
277                         'visible'       => 1,
278                 ],
279                 [
280                         'uri-id'        => 2,
281                         'parent-uri-id' => 1,
282                         'thr-parent-id' => 1,
283                         'gravity'       => GRAVITY_COMMENT,
284                         'network'       => Protocol::DFRN,
285                         'owner-id'      => 42,
286                         'author-id'     => 42,
287                         'causer-id'     => 42,
288                         'vid'           => 8,
289                         'private'       => Item::PUBLIC,
290                         'visible'       => 1,
291                 ],
292                 [
293                         'uri-id'        => 3,
294                         'parent-uri-id' => 3,
295                         'thr-parent-id' => 3,
296                         'gravity'       => GRAVITY_PARENT,
297                         'network'       => Protocol::DFRN,
298                         'owner-id'      => 42,
299                         'author-id'     => 43,
300                         'causer-id'     => 43,
301                         'vid'           => 8,
302                         'private'       => Item::PUBLIC,
303                         'visible'       => 1,
304                 ],
305                 [
306                         'uri-id'        => 4,
307                         'parent-uri-id' => 1,
308                         'thr-parent-id' => 1,
309                         'gravity'       => GRAVITY_COMMENT,
310                         'network'       => Protocol::DFRN,
311                         'owner-id'      => 42,
312                         'author-id'     => 44,
313                         'causer-id'     => 44,
314                         'vid'           => 8,
315                         'private'       => Item::PUBLIC,
316                         'visible'       => 1,
317                 ],
318                 [
319                         'uri-id'        => 5,
320                         'parent-uri-id' => 1,
321                         'thr-parent-id' => 1,
322                         'gravity'       => GRAVITY_COMMENT,
323                         'network'       => Protocol::DFRN,
324                         'owner-id'      => 42,
325                         'author-id'     => 42,
326                         'causer-id'     => 42,
327                         'vid'           => 8,
328                         'private'       => Item::PUBLIC,
329                         'visible'       => 1,
330                 ],
331                 [
332                         'uri-id'        => 6,
333                         'parent-uri-id' => 6,
334                         'thr-parent-id' => 6,
335                         'gravity'       => GRAVITY_PARENT,
336                         'network'       => Protocol::DFRN,
337                         'owner-id'      => 42,
338                         'author-id'     => 44,
339                         'causer-id'     => 44,
340                         'vid'           => 8,
341                         'private'       => Item::PUBLIC,
342                         'visible'       => 1,
343                 ],
344         ],
345         'post-user' => [
346                 [
347                         'id'            => 1,
348                         'parent'        => 1,
349                         'uri-id'        => 1,
350                         'uid'           => 42,
351                         'contact-id'    => 42,
352                         'unseen'        => 1,
353                         'origin'        => 1,
354                         'parent-uri-id' => 1,
355                         'thr-parent-id' => 1,
356                         'gravity'       => GRAVITY_PARENT,
357                         'network'       => Protocol::DFRN,
358                         'owner-id'      => 42,
359                         'author-id'     => 42,
360                         'causer-id'     => 42,
361                         'vid'           => 8,
362                         'private'       => Item::PUBLIC,
363                         'visible'       => 1,
364                 ],
365                 [
366                         'id'            => 2,
367                         'parent'        => 1,
368                         'uri-id'        => 2,
369                         'uid'           => 42,
370                         'contact-id'    => 42,
371                         'unseen'        => 0,
372                         'origin'        => 1,
373                         'parent-uri-id' => 1,
374                         'thr-parent-id' => 1,
375                         'gravity'       => GRAVITY_COMMENT,
376                         'network'       => Protocol::DFRN,
377                         'owner-id'      => 42,
378                         'author-id'     => 42,
379                         'causer-id'     => 42,
380                         'vid'           => 8,
381                         'private'       => Item::PUBLIC,
382                         'visible'       => 1,
383                 ],
384                 [
385                         'id'            => 3,
386                         'parent'        => 3,
387                         'uri-id'        => 3,
388                         'uid'           => 42,
389                         'contact-id'    => 43,
390                         'unseen'        => 0,
391                         'origin'        => 1,
392                         'parent-uri-id' => 3,
393                         'thr-parent-id' => 3,
394                         'gravity'       => GRAVITY_PARENT,
395                         'network'       => Protocol::DFRN,
396                         'owner-id'      => 42,
397                         'author-id'     => 43,
398                         'causer-id'     => 43,
399                         'vid'           => 8,
400                         'private'       => Item::PUBLIC,
401                         'visible'       => 1,
402                 ],
403                 [
404                         'id'            => 4,
405                         'parent'        => 1,
406                         'uri-id'        => 4,
407                         'uid'           => 42,
408                         'contact-id'    => 44,
409                         'unseen'        => 0,
410                         'origin'        => 1,
411                         'parent-uri-id' => 1,
412                         'thr-parent-id' => 1,
413                         'gravity'       => GRAVITY_COMMENT,
414                         'network'       => Protocol::DFRN,
415                         'owner-id'      => 42,
416                         'author-id'     => 44,
417                         'causer-id'     => 44,
418                         'vid'           => 8,
419                         'private'       => Item::PUBLIC,
420                         'visible'       => 1,
421                 ],
422                 [
423                         'id'            => 5,
424                         'parent'        => 1,
425                         'uri-id'        => 5,
426                         'uid'           => 42,
427                         'contact-id'    => 42,
428                         'unseen'        => 0,
429                         'origin'        => 1,
430                         'parent-uri-id' => 1,
431                         'thr-parent-id' => 1,
432                         'gravity'       => GRAVITY_COMMENT,
433                         'network'       => Protocol::DFRN,
434                         'owner-id'      => 42,
435                         'author-id'     => 42,
436                         'causer-id'     => 42,
437                         'vid'           => 8,
438                         'private'       => Item::PUBLIC,
439                         'visible'       => 1,
440                 ],
441                 [
442                         'id'            => 6,
443                         'parent'        => 6,
444                         'uri-id'        => 6,
445                         'uid'           => 42,
446                         'contact-id'    => 44,
447                         'unseen'        => 0,
448                         'origin'        => 1,
449                         'parent-uri-id' => 6,
450                         'thr-parent-id' => 6,
451                         'gravity'       => GRAVITY_PARENT,
452                         'network'       => Protocol::DFRN,
453                         'owner-id'      => 42,
454                         'author-id'     => 44,
455                         'causer-id'     => 44,
456                         'vid'           => 8,
457                         'private'       => Item::PUBLIC,
458                         'visible'       => 1,
459                 ],
460                 [
461                         'id'            => 7,
462                         'parent'        => 7,
463                         'uri-id'        => 1,
464                         'uid'           => 0,
465                         'contact-id'    => 42,
466                         'unseen'        => 1,
467                         'origin'        => 0,
468                         'parent-uri-id' => 1,
469                         'thr-parent-id' => 1,
470                         'gravity'       => GRAVITY_PARENT,
471                         'network'       => Protocol::DFRN,
472                         'owner-id'      => 42,
473                         'author-id'     => 42,
474                         'causer-id'     => 42,
475                         'vid'           => 8,
476                         'private'       => Item::PUBLIC,
477                         'visible'       => 1,
478                 ],
479                 [
480                         'id'            => 8,
481                         'parent'        => 7,
482                         'uri-id'        => 2,
483                         'uid'           => 0,
484                         'contact-id'    => 42,
485                         'unseen'        => 0,
486                         'origin'        => 0,
487                         'parent-uri-id' => 1,
488                         'thr-parent-id' => 1,
489                         'gravity'       => GRAVITY_COMMENT,
490                         'network'       => Protocol::DFRN,
491                         'owner-id'      => 42,
492                         'author-id'     => 42,
493                         'causer-id'     => 42,
494                         'vid'           => 8,
495                         'private'       => Item::PUBLIC,
496                         'visible'       => 1,
497                 ],
498                 [
499                         'id'            => 9,
500                         'parent'        => 9,
501                         'uri-id'        => 3,
502                         'uid'           => 0,
503                         'contact-id'    => 43,
504                         'unseen'        => 0,
505                         'origin'        => 0,
506                         'parent-uri-id' => 3,
507                         'thr-parent-id' => 3,
508                         'gravity'       => GRAVITY_PARENT,
509                         'network'       => Protocol::DFRN,
510                         'owner-id'      => 42,
511                         'author-id'     => 43,
512                         'causer-id'     => 43,
513                         'vid'           => 8,
514                         'private'       => Item::PUBLIC,
515                         'visible'       => 1,
516                 ],
517                 [
518                         'id'            => 10,
519                         'parent'        => 7,
520                         'uri-id'        => 4,
521                         'uid'           => 0,
522                         'contact-id'    => 44,
523                         'unseen'        => 0,
524                         'origin'        => 0,
525                         'parent-uri-id' => 1,
526                         'thr-parent-id' => 1,
527                         'gravity'       => GRAVITY_COMMENT,
528                         'network'       => Protocol::DFRN,
529                         'owner-id'      => 42,
530                         'author-id'     => 44,
531                         'causer-id'     => 44,
532                         'vid'           => 8,
533                         'private'       => Item::PUBLIC,
534                         'visible'       => 1,
535                 ],
536                 [
537                         'id'            => 11,
538                         'parent'        => 7,
539                         'uri-id'        => 5,
540                         'uid'           => 0,
541                         'contact-id'    => 42,
542                         'unseen'        => 0,
543                         'origin'        => 0,
544                         'parent-uri-id' => 1,
545                         'thr-parent-id' => 1,
546                         'gravity'       => GRAVITY_COMMENT,
547                         'network'       => Protocol::DFRN,
548                         'owner-id'      => 42,
549                         'author-id'     => 42,
550                         'causer-id'     => 42,
551                         'vid'           => 8,
552                         'private'       => Item::PUBLIC,
553                         'visible'       => 1,
554                 ],
555                 [
556                         'id'            => 12,
557                         'parent'        => 12,
558                         'uri-id'        => 6,
559                         'uid'           => 0,
560                         'contact-id'    => 44,
561                         'unseen'        => 0,
562                         'origin'        => 0,
563                         'parent-uri-id' => 6,
564                         'thr-parent-id' => 6,
565                         'gravity'       => GRAVITY_PARENT,
566                         'network'       => Protocol::DFRN,
567                         'owner-id'      => 42,
568                         'author-id'     => 44,
569                         'causer-id'     => 44,
570                         'vid'           => 8,
571                         'private'       => Item::PUBLIC,
572                         'visible'       => 1,
573                 ],
574         ],
575         'post-thread'  => [
576                 [
577                         'uri-id'     => 1,
578                         'author-id'  => 42,
579                         'owner-id'   => 42,
580                         'causer-id'  => 42,
581                         'network'    => Protocol::DFRN,
582                 ],
583                 [
584                         'uri-id'     => 3,
585                         'author-id'  => 43,
586                         'owner-id'   => 43,
587                         'causer-id'  => 43,
588                         'network'    => Protocol::DFRN,
589                 ],
590                 [
591                         'uri-id'     => 6,
592                         'author-id'  => 44,
593                         'owner-id'   => 44,
594                         'causer-id'  => 44,
595                         'network'    => Protocol::DFRN,
596                 ],
597         ],
598         'post-thread-user'  => [
599                 [
600                         'uri-id'     => 1,
601                         'uid'        => 42,
602                         'wall'       => 1,
603                         'post-user-id' => 1,
604                         'author-id'  => 42,
605                         'owner-id'   => 42,
606                         'causer-id'  => 42,
607                         'contact-id' => 42,
608                         'network'    => Protocol::DFRN,
609                 ],
610                 [
611                         'uri-id'     => 3,
612                         'uid'        => 42,
613                         'wall'       => 1,
614                         'post-user-id' => 3,
615                         'author-id'  => 43,
616                         'owner-id'   => 43,
617                         'causer-id'  => 43,
618                         'contact-id' => 43,
619                         'network'    => Protocol::DFRN,
620                 ],
621                 [
622                         'uri-id'     => 6,
623                         'uid'        => 42,
624                         'wall'       => 1,
625                         'post-user-id' => 6,
626                         'author-id'  => 44,
627                         'owner-id'   => 44,
628                         'causer-id'  => 44,
629                         'contact-id' => 44,
630                         'network'    => Protocol::DFRN,
631                 ],
632                 [
633                         'uri-id'     => 1,
634                         'uid'        => 0,
635                         'wall'       => 0,
636                         'post-user-id' => 7,
637                         'author-id'  => 42,
638                         'owner-id'   => 42,
639                         'causer-id'  => 42,
640                         'contact-id' => 42,
641                         'network'    => Protocol::DFRN,
642                 ],
643                 [
644                         'uri-id'     => 3,
645                         'uid'        => 0,
646                         'wall'       => 0,
647                         'post-user-id' => 9,
648                         'author-id'  => 43,
649                         'owner-id'   => 43,
650                         'causer-id'  => 43,
651                         'contact-id' => 43,
652                         'network'    => Protocol::DFRN,
653                 ],
654                 [
655                         'uri-id'     => 6,
656                         'uid'        => 0,
657                         'wall'       => 0,
658                         'post-user-id' => 12,
659                         'author-id'  => 44,
660                         'owner-id'   => 44,
661                         'causer-id'  => 44,
662                         'contact-id' => 44,
663                         'network'    => Protocol::DFRN,
664                 ],
665         ],
666         'notify' => [
667                 [
668                         'id' => 1,
669                         'type' => 8,
670                         'name' => 'Reply to',
671                         'url' => 'http://localhost/display/1',
672                         'photo' => 'http://localhost/',
673                         'date' => '2020-01-01 12:12:02',
674                         'msg' => 'A test reply from an item',
675                         'uid' => 42,
676                         'link' => 'http://localhost/notification/1',
677                         'iid' => 4,
678                         'seen' => 0,
679                         'verb' => '',
680                         'otype' => Notification\ObjectType::ITEM,
681                         'name_cache' => 'Reply to',
682                         'msg_cache' => 'A test reply from an item',
683                 ],
684         ],
685         'profile' => [
686                 [
687                         'id' => 1,
688                         'uid' => 42,
689                 ],
690         ],
691         'group'   => [
692                 [
693                         'id'      => 1,
694                         'uid'     => 42,
695                         'visible' => 1,
696                         'name'    => 'Visible list',
697                 ],
698                 [
699                         'id'      => 2,
700                         'uid'     => 42,
701                         'visible' => 0,
702                         'name'    => 'Private list',
703                 ],
704         ],
705         'search'  => [
706                 [
707                         'id'   => 1,
708                         'term' => 'Saved search',
709                         'uid'  => 42,
710                 ],
711         ],
712 ];