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