1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ContentTests; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use CommonTestClass; |
7
|
|
|
use kalanis\kw_files\Access\Factory; |
8
|
|
|
use kalanis\kw_files\Extended\Config; |
9
|
|
|
use kalanis\kw_files\FilesException; |
10
|
|
|
use kalanis\kw_images\Content\BasicOperations; |
11
|
|
|
use kalanis\kw_images\Sources; |
12
|
|
|
use kalanis\kw_paths\PathsException; |
13
|
|
|
use kalanis\kw_storage\Storage\Key; |
14
|
|
|
use kalanis\kw_storage\Storage\Target; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
class BasicOperationsTest extends CommonTestClass |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @throws FilesException |
21
|
|
|
* @throws PathsException |
22
|
|
|
*/ |
23
|
|
|
public function testCopyPass(): void |
24
|
|
|
{ |
25
|
|
|
$lib = $this->getLib(); |
26
|
|
|
|
27
|
|
|
$src = ['testtree', 'testimage.png']; |
28
|
|
|
$tgt = ['targettree', 'testimage.png']; |
29
|
|
|
|
30
|
|
|
// check |
31
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
32
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
33
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
34
|
|
|
|
35
|
|
|
// set fot test |
36
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
37
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
38
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
39
|
|
|
|
40
|
|
|
// check again |
41
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
42
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
43
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
44
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($tgt)); |
45
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($tgt)); |
46
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($tgt)); |
47
|
|
|
|
48
|
|
|
// action! |
49
|
|
|
$this->assertTrue($lib->copy($src, ['targettree'])); |
50
|
|
|
|
51
|
|
|
// check result |
52
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
53
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
54
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
55
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($tgt)); |
56
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($tgt)); |
57
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($tgt)); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @throws FilesException |
62
|
|
|
* @throws PathsException |
63
|
|
|
*/ |
64
|
|
|
public function testCopyFailThumb(): void |
65
|
|
|
{ |
66
|
|
|
$lib = $this->getFailThumbLib(); |
67
|
|
|
|
68
|
|
|
$src = ['testtree', 'testimage.png']; |
69
|
|
|
|
70
|
|
|
// check |
71
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
72
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
73
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
74
|
|
|
|
75
|
|
|
// set fot test |
76
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
77
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
78
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
79
|
|
|
|
80
|
|
|
// check again |
81
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
82
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
83
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
84
|
|
|
|
85
|
|
|
// action! |
86
|
|
|
$this->expectExceptionMessage('mock thumb copy fail'); |
87
|
|
|
$this->expectException(FilesException::class); |
88
|
|
|
$lib->copy($src, ['targettree']); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @throws FilesException |
93
|
|
|
* @throws PathsException |
94
|
|
|
*/ |
95
|
|
|
public function testCopyFailDesc(): void |
96
|
|
|
{ |
97
|
|
|
$lib = $this->getFailDescLib(); |
98
|
|
|
|
99
|
|
|
$src = ['testtree', 'testimage.png']; |
100
|
|
|
|
101
|
|
|
// check |
102
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
103
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
104
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
105
|
|
|
|
106
|
|
|
// set fot test |
107
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
108
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
109
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
110
|
|
|
|
111
|
|
|
// check again |
112
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
113
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
114
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
115
|
|
|
|
116
|
|
|
// action! |
117
|
|
|
$this->expectExceptionMessage('mock desc copy fail'); |
118
|
|
|
$this->expectException(FilesException::class); |
119
|
|
|
$lib->copy($src, ['targettree']); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @throws FilesException |
124
|
|
|
* @throws PathsException |
125
|
|
|
*/ |
126
|
|
|
public function testMovePass(): void |
127
|
|
|
{ |
128
|
|
|
$lib = $this->getLib(); |
129
|
|
|
|
130
|
|
|
$src = ['testtree', 'testimage.png']; |
131
|
|
|
$tgt = ['targettree', 'testimage.png']; |
132
|
|
|
|
133
|
|
|
// check |
134
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
135
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
136
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
137
|
|
|
|
138
|
|
|
// set fot test |
139
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
140
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
141
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
142
|
|
|
|
143
|
|
|
// check again |
144
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
145
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
146
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
147
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($tgt)); |
148
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($tgt)); |
149
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($tgt)); |
150
|
|
|
|
151
|
|
|
// action! |
152
|
|
|
$this->assertTrue($lib->move($src, ['targettree'])); |
153
|
|
|
|
154
|
|
|
// check result |
155
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
156
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
157
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
158
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($tgt)); |
159
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($tgt)); |
160
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($tgt)); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @throws FilesException |
165
|
|
|
* @throws PathsException |
166
|
|
|
*/ |
167
|
|
|
public function testMoveFailThumb(): void |
168
|
|
|
{ |
169
|
|
|
$lib = $this->getFailThumbLib(); |
170
|
|
|
|
171
|
|
|
$src = ['testtree', 'testimage.png']; |
172
|
|
|
|
173
|
|
|
// check |
174
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
175
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
176
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
177
|
|
|
|
178
|
|
|
// set fot test |
179
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
180
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
181
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
182
|
|
|
|
183
|
|
|
// check again |
184
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
185
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
186
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
187
|
|
|
|
188
|
|
|
// action! |
189
|
|
|
$this->expectExceptionMessage('mock thumb move fail'); |
190
|
|
|
$this->expectException(FilesException::class); |
191
|
|
|
$lib->move($src, ['targettree']); |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @throws FilesException |
196
|
|
|
* @throws PathsException |
197
|
|
|
*/ |
198
|
|
|
public function testMoveFailDesc(): void |
199
|
|
|
{ |
200
|
|
|
$lib = $this->getFailDescLib(); |
201
|
|
|
|
202
|
|
|
$src = ['testtree', 'testimage.png']; |
203
|
|
|
|
204
|
|
|
// check |
205
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
206
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
207
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
208
|
|
|
|
209
|
|
|
// set fot test |
210
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
211
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
212
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
213
|
|
|
|
214
|
|
|
// check again |
215
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
216
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
217
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
218
|
|
|
|
219
|
|
|
// action! |
220
|
|
|
$this->expectExceptionMessage('mock desc move fail'); |
221
|
|
|
$this->expectException(FilesException::class); |
222
|
|
|
$lib->move($src, ['targettree']); |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @throws FilesException |
227
|
|
|
* @throws PathsException |
228
|
|
|
*/ |
229
|
|
|
public function testRenamePass(): void |
230
|
|
|
{ |
231
|
|
|
$lib = $this->getLib(); |
232
|
|
|
|
233
|
|
|
$src = ['testtree', 'testimage.png']; |
234
|
|
|
$tgt = ['testtree', 'tstimg1.png']; |
235
|
|
|
|
236
|
|
|
// check |
237
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
238
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
239
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
240
|
|
|
|
241
|
|
|
// set fot test |
242
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
243
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
244
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
245
|
|
|
|
246
|
|
|
// check again |
247
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
248
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
249
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
250
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($tgt)); |
251
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($tgt)); |
252
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($tgt)); |
253
|
|
|
|
254
|
|
|
// action! |
255
|
|
|
$this->assertTrue($lib->rename($src, 'tstimg1.png')); |
256
|
|
|
|
257
|
|
|
// check result |
258
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
259
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
260
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
261
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($tgt)); |
262
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($tgt)); |
263
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($tgt)); |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* @throws FilesException |
268
|
|
|
* @throws PathsException |
269
|
|
|
*/ |
270
|
|
|
public function testRenameFailThumb(): void |
271
|
|
|
{ |
272
|
|
|
$lib = $this->getFailThumbLib(); |
273
|
|
|
|
274
|
|
|
$src = ['testtree', 'testimage.png']; |
275
|
|
|
|
276
|
|
|
// check |
277
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
278
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
279
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
280
|
|
|
|
281
|
|
|
// set fot test |
282
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
283
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
284
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
285
|
|
|
|
286
|
|
|
// check again |
287
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
288
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
289
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
290
|
|
|
|
291
|
|
|
// action! |
292
|
|
|
$this->expectExceptionMessage('mock thumb rename fail'); |
293
|
|
|
$this->expectException(FilesException::class); |
294
|
|
|
$lib->rename($src, 'tstimg1.png'); |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @throws FilesException |
299
|
|
|
* @throws PathsException |
300
|
|
|
*/ |
301
|
|
|
public function testRenameFailDesc(): void |
302
|
|
|
{ |
303
|
|
|
$lib = $this->getFailDescLib(); |
304
|
|
|
|
305
|
|
|
$src = ['testtree', 'testimage.png']; |
306
|
|
|
|
307
|
|
|
// check |
308
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
309
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
310
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
311
|
|
|
|
312
|
|
|
// set fot test |
313
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
314
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
315
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
316
|
|
|
|
317
|
|
|
// check again |
318
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
319
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
320
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
321
|
|
|
|
322
|
|
|
// action! |
323
|
|
|
$this->expectExceptionMessage('mock desc rename fail'); |
324
|
|
|
$this->expectException(FilesException::class); |
325
|
|
|
$lib->rename($src, 'tstimg1.png'); |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @throws FilesException |
330
|
|
|
* @throws PathsException |
331
|
|
|
*/ |
332
|
|
|
public function testDelete(): void |
333
|
|
|
{ |
334
|
|
|
$lib = $this->getLib(); |
335
|
|
|
|
336
|
|
|
$src = ['testdir', 'testimage.png']; |
337
|
|
|
|
338
|
|
|
// check |
339
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
340
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
341
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
342
|
|
|
|
343
|
|
|
// set fot test |
344
|
|
|
$this->assertTrue($lib->getLibImage()->set($src, static::TEST_STRING)); |
345
|
|
|
$this->assertTrue($lib->getLibDesc()->set($src, static::TEST_STRING)); |
346
|
|
|
$this->assertTrue($lib->getLibThumb()->set($src, static::TEST_STRING)); |
347
|
|
|
|
348
|
|
|
// check again |
349
|
|
|
$this->assertTrue($lib->getLibImage()->isHere($src)); |
350
|
|
|
$this->assertTrue($lib->getLibDesc()->isHere($src)); |
351
|
|
|
$this->assertTrue($lib->getLibThumb()->isHere($src)); |
352
|
|
|
|
353
|
|
|
// action! |
354
|
|
|
$this->assertTrue($lib->delete($src)); |
355
|
|
|
|
356
|
|
|
// check empty |
357
|
|
|
$this->assertFalse($lib->getLibImage()->isHere($src)); |
358
|
|
|
$this->assertFalse($lib->getLibDesc()->isHere($src)); |
359
|
|
|
$this->assertFalse($lib->getLibThumb()->isHere($src)); |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* @param array<string, string|int> $params |
364
|
|
|
* @throws FilesException |
365
|
|
|
* @throws PathsException |
366
|
|
|
* @return XBasicOperations |
367
|
|
|
*/ |
368
|
|
|
protected function getLib(array $params = []): XBasicOperations |
369
|
|
|
{ |
370
|
|
|
$config = (new Config())->setData($params); |
371
|
|
|
$storage = new \kalanis\kw_storage\Storage\Storage(new Key\DefaultKey(), new Target\Memory()); |
372
|
|
|
$composite = new Factory(); |
373
|
|
|
$access = $composite->getClass($storage); |
374
|
|
|
|
375
|
|
|
return new XBasicOperations( |
376
|
|
|
new Sources\Image($access, $config), |
377
|
|
|
new Sources\Thumb($access, $config), |
378
|
|
|
new Sources\Desc($access, $config) |
379
|
|
|
); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
/** |
383
|
|
|
* @param array<string, string|int> $params |
384
|
|
|
* @throws FilesException |
385
|
|
|
* @throws PathsException |
386
|
|
|
* @return XBasicOperations |
387
|
|
|
*/ |
388
|
|
|
protected function getFailThumbLib(array $params = []): XBasicOperations |
389
|
|
|
{ |
390
|
|
|
$config = (new Config())->setData($params); |
391
|
|
|
$storage = new \kalanis\kw_storage\Storage\Storage(new Key\DefaultKey(), new Target\Memory()); |
392
|
|
|
$composite = new Factory(); |
393
|
|
|
$access = $composite->getClass($storage); |
394
|
|
|
|
395
|
|
|
return new XBasicOperations( |
396
|
|
|
new Sources\Image($access, $config), |
397
|
|
|
new XSourceThumbDie($access, $config), |
398
|
|
|
new Sources\Desc($access, $config) |
399
|
|
|
); |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* @param array<string, string|int> $params |
404
|
|
|
* @throws FilesException |
405
|
|
|
* @throws PathsException |
406
|
|
|
* @return XBasicOperations |
407
|
|
|
*/ |
408
|
|
|
protected function getFailDescLib(array $params = []): XBasicOperations |
409
|
|
|
{ |
410
|
|
|
$config = (new Config())->setData($params); |
411
|
|
|
$storage = new \kalanis\kw_storage\Storage\Storage(new Key\DefaultKey(), new Target\Memory()); |
412
|
|
|
$composite = new Factory(); |
413
|
|
|
$access = $composite->getClass($storage); |
414
|
|
|
|
415
|
|
|
return new XBasicOperations( |
416
|
|
|
new Sources\Image($access, $config), |
417
|
|
|
new Sources\Thumb($access, $config), |
418
|
|
|
new XSourceDescDie($access, $config) |
419
|
|
|
); |
420
|
|
|
} |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
|
424
|
|
|
class XBasicOperations extends BasicOperations |
425
|
|
|
{ |
426
|
|
|
public function getLibImage(): Sources\Image |
427
|
|
|
{ |
428
|
|
|
return $this->libImage; |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
public function getLibThumb(): Sources\Thumb |
432
|
|
|
{ |
433
|
|
|
return $this->libThumb; |
434
|
|
|
} |
435
|
|
|
|
436
|
|
|
public function getLibDesc(): Sources\Desc |
437
|
|
|
{ |
438
|
|
|
return $this->libDesc; |
439
|
|
|
} |
440
|
|
|
} |
441
|
|
|
|
442
|
|
|
|
443
|
|
|
class XSourceDescDie extends Sources\Desc |
444
|
|
|
{ |
445
|
|
|
public function copy(string $fileName, array $sourceDir, array $targetDir, bool $overwrite = false): bool |
446
|
|
|
{ |
447
|
|
|
throw new FilesException('mock desc copy fail'); |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
public function move(string $fileName, array $sourceDir, array $targetDir, bool $overwrite = false): bool |
451
|
|
|
{ |
452
|
|
|
throw new FilesException('mock desc move fail'); |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
public function rename(array $path, string $sourceName, string $targetName, bool $overwrite = false): bool |
456
|
|
|
{ |
457
|
|
|
throw new FilesException('mock desc rename fail'); |
458
|
|
|
} |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
|
462
|
|
|
class XSourceThumbDie extends Sources\Thumb |
463
|
|
|
{ |
464
|
|
|
public function copy(string $fileName, array $sourceDir, array $targetDir, bool $overwrite = false): bool |
465
|
|
|
{ |
466
|
|
|
throw new FilesException('mock thumb copy fail'); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
public function move(string $fileName, array $sourceDir, array $targetDir, bool $overwrite = false): bool |
470
|
|
|
{ |
471
|
|
|
throw new FilesException('mock thumb move fail'); |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
public function rename(array $path, string $sourceName, string $targetName, bool $overwrite = false): bool |
475
|
|
|
{ |
476
|
|
|
throw new FilesException('mock thumb rename fail'); |
477
|
|
|
} |
478
|
|
|
} |
479
|
|
|
|