]> git.mxchange.org Git - friendica.git/blob - tests/src/Module/Api/Mastodon/SearchTest.php
mark remaining Mastodon tests incomplete because of needed refactoring
[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                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
17
18                 /*
19                 $_REQUEST['q']      = 'reply';
20                 $_REQUEST['max_id'] = 10;
21                 $result             = api_search('json');
22                 foreach ($result['status'] as $status) {
23                         self::assertStatus($status);
24                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
25                 }
26                 */
27         }
28
29         /**
30          * Test the api_search() function a count parameter.
31          *
32          * @return void
33          */
34         public function testApiSearchWithCount()
35         {
36                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
37
38                 /*
39                 $_REQUEST['q']     = 'reply';
40                 $_REQUEST['count'] = 20;
41                 $result            = api_search('json');
42                 foreach ($result['status'] as $status) {
43                         self::assertStatus($status);
44                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
45                 }
46                 */
47         }
48
49         /**
50          * Test the api_search() function with an rpp parameter.
51          *
52          * @return void
53          */
54         public function testApiSearchWithRpp()
55         {
56                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
57
58                 /*
59                 $_REQUEST['q']   = 'reply';
60                 $_REQUEST['rpp'] = 20;
61                 $result          = api_search('json');
62                 foreach ($result['status'] as $status) {
63                         self::assertStatus($status);
64                         self::assertStringContainsStringIgnoringCase('reply', $status['text'], '', true);
65                 }
66                 */
67         }
68
69         /**
70          * Test the api_search() function with an q parameter contains hashtag.
71          * @doesNotPerformAssertions
72          */
73         public function testApiSearchWithHashtag()
74         {
75                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
76
77                 /*
78                 $_REQUEST['q'] = '%23friendica';
79                 $result        = api_search('json');
80                 foreach ($result['status'] as $status) {
81                         self::assertStatus($status);
82                         self::assertStringContainsStringIgnoringCase('#friendica', $status['text'], '', true);
83                 }
84                 */
85         }
86
87         /**
88          * Test the api_search() function with an exclude_replies parameter.
89          * @doesNotPerformAssertions
90          */
91         public function testApiSearchWithExcludeReplies()
92         {
93                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
94
95                 /*
96                 $_REQUEST['max_id']          = 10;
97                 $_REQUEST['exclude_replies'] = true;
98                 $_REQUEST['q']               = 'friendica';
99                 $result                      = api_search('json');
100                 foreach ($result['status'] as $status) {
101                         self::assertStatus($status);
102                 }
103                 */
104         }
105
106         /**
107          * Test the api_search() function without an authenticated user.
108          *
109          * @return void
110          */
111         public function testApiSearchWithUnallowedUser()
112         {
113                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
114
115                 // $this->expectException(\Friendica\Network\HTTPException\UnauthorizedException::class);
116                 // BasicAuth::setCurrentUserID();
117                 // api_search('json');
118         }
119
120         /**
121          * Test the api_search() function without any GET query parameter.
122          *
123          * @return void
124          */
125         public function testApiSearchWithoutQuery()
126         {
127                 self::markTestIncomplete('Needs Search to not set header during call (like at BaseApi::setLinkHeader');
128
129                 // $this->expectException(\Friendica\Network\HTTPException\BadRequestException::class);
130                 // api_search('json');
131         }
132 }