|
12 | 12 | #[CoversClass(Query::class)] |
13 | 13 | final class QueryTest extends TestCase |
14 | 14 | { |
15 | | - #[DataProvider('provideConstructorCases')] |
| 15 | + #[DataProvider('constructorPropsProvider')] |
16 | 16 | public function testConstructor( |
17 | 17 | ?string $searchQuery, |
18 | 18 | array $types, |
@@ -102,72 +102,7 @@ public function testConstructor( |
102 | 102 | ); |
103 | 103 | } |
104 | 104 |
|
105 | | - public static function provideConstructorCases(): iterable |
106 | | - { |
107 | | - return [ |
108 | | - [ |
109 | | - 'test search', |
110 | | - [], |
111 | | - [], |
112 | | - [], |
113 | | - [], |
114 | | - [], |
115 | | - [], |
116 | | - [], |
117 | | - 25, |
118 | | - null, |
119 | | - ['created_at' => 'desc'], |
120 | | - 'test search|25|||||||||created_at=desc', |
121 | | - ], |
122 | | - [ |
123 | | - null, |
124 | | - ['audio', 'video'], |
125 | | - ['root/images', 'root/videos'], |
126 | | - ['public', 'private'], |
127 | | - ['tag1', 'tag2', 'tag3'], |
128 | | - [], |
129 | | - ['hash1', 'hash2', 'hash3'], |
130 | | - [ |
131 | | - 'type' => ['product_image', 'product_category'], |
132 | | - 'source' => 'webshop', |
133 | | - ], |
134 | | - 30, |
135 | | - null, |
136 | | - ['updated_at' => 'asc'], |
137 | | - '|30||audio,video|root/images,root/videos|public,private|tag1,tag2,tag3||hash1,hash2,hash3|type=product_image,type=product_category,source=webshop|updated_at=asc', |
138 | | - ], |
139 | | - [ |
140 | | - null, |
141 | | - [], |
142 | | - [], |
143 | | - [], |
144 | | - [], |
145 | | - ['root/images/image1.jpg', 'root/videos/example.mp4'], |
146 | | - [], |
147 | | - [], |
148 | | - 25, |
149 | | - null, |
150 | | - ['created_at' => 'desc'], |
151 | | - '|25||||||root/images/image1.jpg,root/videos/example.mp4|||created_at=desc', |
152 | | - ], |
153 | | - [ |
154 | | - 'unix', |
155 | | - ['image'], |
156 | | - ['root/images'], |
157 | | - ['protected'], |
158 | | - ['tech'], |
159 | | - [], |
160 | | - [], |
161 | | - [], |
162 | | - 25, |
163 | | - 'd395jdgew45nd73kjsijfh', |
164 | | - ['created_at' => 'asc'], |
165 | | - 'unix|25|d395jdgew45nd73kjsijfh|image|root/images|protected|tech||||created_at=asc', |
166 | | - ], |
167 | | - ]; |
168 | | - } |
169 | | - |
170 | | - #[DataProvider('provideFromRemoteIdsCases')] |
| 105 | + #[DataProvider('remoteIdsProvider')] |
171 | 106 | public function testFromRemoteIds( |
172 | 107 | array $remoteIds, |
173 | 108 | int $limit, |
@@ -215,26 +150,6 @@ public function testFromRemoteIds( |
215 | 150 | ); |
216 | 151 | } |
217 | 152 |
|
218 | | - public static function provideFromRemoteIdsCases(): iterable |
219 | | - { |
220 | | - return [ |
221 | | - [ |
222 | | - ['image.jpg', 'test/subfolder/document.pdf', 'videos/example.mp4', 'media/audio/song.mp3'], |
223 | | - 100, |
224 | | - null, |
225 | | - ['created_at' => 'asc'], |
226 | | - '|100||||||image.jpg,test/subfolder/document.pdf,videos/example.mp4,media/audio/song.mp3|||created_at=asc', |
227 | | - ], |
228 | | - [ |
229 | | - ['image.jpg'], |
230 | | - 25, |
231 | | - 'ewdsofu439oirejfoi3', |
232 | | - ['updated_at' => 'desc'], |
233 | | - '|25|ewdsofu439oirejfoi3|||||image.jpg|||updated_at=desc', |
234 | | - ], |
235 | | - ]; |
236 | | - } |
237 | | - |
238 | 153 | public function testSimpleFromRemoteIds(): void |
239 | 154 | { |
240 | 155 | $query = Query::fromRemoteIds(['test/image.jpg']); |
@@ -283,4 +198,89 @@ public function testSettingNextCursor(): void |
283 | 198 | $query->getNextCursor(), |
284 | 199 | ); |
285 | 200 | } |
| 201 | + |
| 202 | + public static function constructorPropsProvider(): array |
| 203 | + { |
| 204 | + return [ |
| 205 | + [ |
| 206 | + 'test search', |
| 207 | + [], |
| 208 | + [], |
| 209 | + [], |
| 210 | + [], |
| 211 | + [], |
| 212 | + [], |
| 213 | + [], |
| 214 | + 25, |
| 215 | + null, |
| 216 | + ['created_at' => 'desc'], |
| 217 | + 'test search|25|||||||||created_at=desc', |
| 218 | + ], |
| 219 | + [ |
| 220 | + null, |
| 221 | + ['audio', 'video'], |
| 222 | + ['root/images', 'root/videos'], |
| 223 | + ['public', 'private'], |
| 224 | + ['tag1', 'tag2', 'tag3'], |
| 225 | + [], |
| 226 | + ['hash1', 'hash2', 'hash3'], |
| 227 | + [ |
| 228 | + 'type' => ['product_image', 'product_category'], |
| 229 | + 'source' => 'webshop', |
| 230 | + ], |
| 231 | + 30, |
| 232 | + null, |
| 233 | + ['updated_at' => 'asc'], |
| 234 | + '|30||audio,video|root/images,root/videos|public,private|tag1,tag2,tag3||hash1,hash2,hash3|type=product_image,type=product_category,source=webshop|updated_at=asc', |
| 235 | + ], |
| 236 | + [ |
| 237 | + null, |
| 238 | + [], |
| 239 | + [], |
| 240 | + [], |
| 241 | + [], |
| 242 | + ['root/images/image1.jpg', 'root/videos/example.mp4'], |
| 243 | + [], |
| 244 | + [], |
| 245 | + 25, |
| 246 | + null, |
| 247 | + ['created_at' => 'desc'], |
| 248 | + '|25||||||root/images/image1.jpg,root/videos/example.mp4|||created_at=desc', |
| 249 | + ], |
| 250 | + [ |
| 251 | + 'unix', |
| 252 | + ['image'], |
| 253 | + ['root/images'], |
| 254 | + ['protected'], |
| 255 | + ['tech'], |
| 256 | + [], |
| 257 | + [], |
| 258 | + [], |
| 259 | + 25, |
| 260 | + 'd395jdgew45nd73kjsijfh', |
| 261 | + ['created_at' => 'asc'], |
| 262 | + 'unix|25|d395jdgew45nd73kjsijfh|image|root/images|protected|tech||||created_at=asc', |
| 263 | + ], |
| 264 | + ]; |
| 265 | + } |
| 266 | + |
| 267 | + public static function remoteIdsProvider(): array |
| 268 | + { |
| 269 | + return [ |
| 270 | + [ |
| 271 | + ['image.jpg', 'test/subfolder/document.pdf', 'videos/example.mp4', 'media/audio/song.mp3'], |
| 272 | + 100, |
| 273 | + null, |
| 274 | + ['created_at' => 'asc'], |
| 275 | + '|100||||||image.jpg,test/subfolder/document.pdf,videos/example.mp4,media/audio/song.mp3|||created_at=asc', |
| 276 | + ], |
| 277 | + [ |
| 278 | + ['image.jpg'], |
| 279 | + 25, |
| 280 | + 'ewdsofu439oirejfoi3', |
| 281 | + ['updated_at' => 'desc'], |
| 282 | + '|25|ewdsofu439oirejfoi3|||||image.jpg|||updated_at=desc', |
| 283 | + ], |
| 284 | + ]; |
| 285 | + } |
286 | 286 | } |
0 commit comments