]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Mastodon/SearchTest.php
417cb4d4b84a455cba9c55096c9cfbf5011f1c70
[friendica.git] / tests / src / Module / Api / Mastodon / SearchTest.php
1 <?php
2
3 namespace Friendica\Test\src\Module\Api\Mastodon;
4
5 use Friendica\Test\src\Module\Api\ApiTest;
6
7 class SearchTest extends ApiTest
8 {
9         /**
10          * Test the api_search() function.
11          *
12          * @return void
13          */
14         public function testApiSearch()
15         {
16                 /*
17                 $_REQUEST['q']      = 'reply';
18                 $_REQUEST['max_id'] = 10;
19                 $result             = api_search('json');
20                 foreach ($result['status'] as $status) {
21                         self::assertStatus($status);
22                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
23                 }
24                 */
25         }
26
27         /**
28          * Test the api_search() function a count parameter.
29          *
30          * @return void
31          */
32         public function testApiSearchWithCount()
33         {
34                 /*
35                 $_REQUEST['q']     = 'reply';
36                 $_REQUEST['count'] = 20;
37                 $result            = api_search('json');
38                 foreach ($result['status'] as $status) {
39                         self::assertStatus($status);
40                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
41                 }
42                 */
43         }
44
45         /**
46          * Test the api_search() function with an rpp parameter.
47          *
48          * @return void
49          */
50         public function testApiSearchWithRpp()
51         {
52                 /*
53                 $_REQUEST['q']   = 'reply';
54                 $_REQUEST['rpp'] = 20;
55                 $result          = api_search('json');
56                 foreach ($result['status'] as $status) {
57                         self::assertStatus($status);
58                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
59                 }
60                 */
61         }
62
63         /**
64          * Test the api_search() function with an q parameter contains hashtag.
65          * @doesNotPerformAssertions
66          */
67         public function testApiSearchWithHashtag()
68         {
69                 /*
70                 $_REQUEST['q'] = '%23friendica';
71                 $result        = api_search('json');
72                 foreach ($result['status'] as $status) {
73                         self::assertStatus($status);
74                         self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
75                 }
76                 */
77         }
78
79         /**
80          * Test the api_search() function with an exclude_replies parameter.
81          * @doesNotPerformAssertions
82          */
83         public function testApiSearchWithExcludeReplies()
84         {
85                 /*
86                 $_REQUEST['max_id']          = 10;
87                 $_REQUEST['exclude_replies'] = true;
88                 $_REQUEST['q']               = 'friendica';
89                 $result                      = api_search('json');
90                 foreach ($result['status'] as $status) {
91                         self::assertStatus($status);
92                 }
93                 */
94         }
95
96         /**
97          * Test the api_search() function without an authenticated user.
98          *
99          * @return void
100          */
101         public function testApiSearchWithUnallowedUser()
102         {
103                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
104                 // BasicAuth::setCurrentUserID();
105                 // api_search('json');
106         }
107
108         /**
109          * Test the api_search() function without any GET query parameter.
110          *
111          * @return void
112          */
113         public function testApiSearchWithoutQuery()
114         {
115                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
116                 // api_search('json');
117         }
118 }