Test Setup Failed
Push — test ( 8a509e...53e2ac )
by Jonathan
03:34
created

testConstructBlockDevice()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 26
Code Lines 20

Duplication

Lines 26
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 20
c 1
b 0
f 0
nc 2
nop 0
dl 26
loc 26
rs 8.8571
1
<?php
2
3
namespace Kint\Test\Object\Representation;
4
5
use DateTime;
6
use Kint\Object\Representation\SplFileInfoRepresentation;
7
use Kint\Test\KintTestCase;
8
use SplFileInfo;
9
use UnexpectedValueException;
10
11
class SplFileInfoRepresentationTest extends KintTestCase
12
{
13
    protected $socket;
14
15
    public function setUp()
16
    {
17
        symlink(__DIR__, __DIR__.'/testDirLink');
18
        symlink(__FILE__, __DIR__.'/testFileLink');
19
        symlink(__DIR__.'/testDirLink', __DIR__.'/testDirLink2');
20
        symlink(__DIR__.'/testFileLink', __DIR__.'/testFileLink2');
21
22
        posix_mkfifo(__DIR__.'/testPipe', 0777);
23
24
        $this->socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
25
        socket_bind($this->socket, __DIR__.'/testSocket');
26
27
        // Another /dev/null, but as a block device
28
        posix_mknod('/dev/blocknull', POSIX_S_IFBLK | 0777, 1, 3);
29
    }
30
31
    public function tearDown()
32
    {
33
        unlink(__DIR__.'/testDirLink2');
34
        unlink(__DIR__.'/testFileLink2');
35
        unlink(__DIR__.'/testDirLink');
36
        unlink(__DIR__.'/testFileLink');
37
38
        unlink(__DIR__.'/testPipe');
39
40
        socket_close($this->socket);
41
        unlink(__DIR__.'/testSocket');
42
43
        unlink('/dev/blocknull');
44
    }
45
46
    /**
47
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
48
     */
49 View Code Duplication
    public function testConstructFile()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        $r = new SplFileInfoRepresentation(new SplFileInfo(__FILE__));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
52
53
        $this->assertSame(filesize(__FILE__), $r->size);
54
        $this->assertSame(filectime(__FILE__), $r->ctime);
55
        $this->assertSame(filemtime(__FILE__), $r->mtime);
56
        $this->assertSame(fileperms(__FILE__), $r->perms);
57
        $this->assertSame(fileowner(__FILE__), $r->owner);
58
        $this->assertSame(filegroup(__FILE__), $r->group);
59
        $this->assertSame('File', $r->typename);
60
        $this->assertSame('-', $r->typeflag);
61
        $this->assertSame(__FILE__, $r->path);
62
        $this->assertSame(__FILE__, $r->realpath);
63
        $this->assertNull($r->linktarget);
64
65
        if (filetype(__FILE__) === 'file') {
66
            $this->assertTrue($r->is_file);
67
            $this->assertFalse($r->is_dir);
68
            $this->assertFalse($r->is_link);
69
        } else {
70
            throw new UnexpectedValueException(__FILE__.' type is not "file"');
71
        }
72
    }
73
74
    /**
75
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
76
     */
77 View Code Duplication
    public function testConstructFileLink()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78
    {
79
        $f = __DIR__.'/testFileLink2';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
80
81
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
82
83
        $this->assertSame(filesize($f), $r->size);
84
        $this->assertSame(filectime($f), $r->ctime);
85
        $this->assertSame(filemtime($f), $r->mtime);
86
        $this->assertSame(fileperms($f), $r->perms);
87
        $this->assertSame(fileowner($f), $r->owner);
88
        $this->assertSame(filegroup($f), $r->group);
89
        $this->assertSame('File symlink', $r->typename);
90
        $this->assertSame('l', $r->typeflag);
91
        $this->assertSame($f, $r->path);
92
        $this->assertSame(__FILE__, $r->realpath);
93
        $this->assertSame(__DIR__.'/testFileLink', $r->linktarget);
94
95
        if (filetype($f) === 'link') {
96
            $this->assertTrue($r->is_file);
97
            $this->assertFalse($r->is_dir);
98
            $this->assertTrue($r->is_link);
99
        } else {
100
            throw new UnexpectedValueException($f.' type is not "link"');
101
        }
102
    }
103
104
    /**
105
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
106
     */
107 View Code Duplication
    public function testConstructLinkedFile()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
108
    {
109
        $f = __DIR__.'/testDirLink/'.basename(__FILE__);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
110
111
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
112
113
        $this->assertSame(filesize($f), $r->size);
114
        $this->assertSame(filectime($f), $r->ctime);
115
        $this->assertSame(filemtime($f), $r->mtime);
116
        $this->assertSame(fileperms($f), $r->perms);
117
        $this->assertSame(fileowner($f), $r->owner);
118
        $this->assertSame(filegroup($f), $r->group);
119
        $this->assertSame('File', $r->typename);
120
        $this->assertSame('-', $r->typeflag);
121
        $this->assertSame($f, $r->path);
122
        $this->assertSame(__FILE__, $r->realpath);
123
        $this->assertNull($r->linktarget);
124
125
        if (filetype($f) === 'file') {
126
            $this->assertTrue($r->is_file);
127
            $this->assertFalse($r->is_dir);
128
            $this->assertFalse($r->is_link);
129
        } else {
130
            throw new UnexpectedValueException($f.' type is not "file"');
131
        }
132
    }
133
134
    /**
135
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
136
     */
137 View Code Duplication
    public function testConstructDir()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
138
    {
139
        $r = new SplFileInfoRepresentation(new SplFileInfo(__DIR__));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
140
141
        $this->assertSame(filesize(__DIR__), $r->size);
142
        $this->assertSame(filectime(__DIR__), $r->ctime);
143
        $this->assertSame(filemtime(__DIR__), $r->mtime);
144
        $this->assertSame(fileperms(__DIR__), $r->perms);
145
        $this->assertSame(fileowner(__DIR__), $r->owner);
146
        $this->assertSame(filegroup(__DIR__), $r->group);
147
        $this->assertSame('Directory', $r->typename);
148
        $this->assertSame('d', $r->typeflag);
149
        $this->assertSame(__DIR__, $r->path);
150
        $this->assertSame(__DIR__, $r->realpath);
151
        $this->assertNull($r->linktarget);
152
153
        if (filetype(__DIR__) === 'dir') {
154
            $this->assertFalse($r->is_file);
155
            $this->assertTrue($r->is_dir);
156
            $this->assertFalse($r->is_link);
157
        } else {
158
            throw new UnexpectedValueException(__DIR__.' type is not "dir"');
159
        }
160
    }
161
162
    /**
163
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
164
     */
165 View Code Duplication
    public function testConstructDirLink()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
166
    {
167
        $f = __DIR__.'/testDirLink2';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
168
169
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
170
171
        $this->assertSame(filesize($f), $r->size);
172
        $this->assertSame(filectime($f), $r->ctime);
173
        $this->assertSame(filemtime($f), $r->mtime);
174
        $this->assertSame(fileperms($f), $r->perms);
175
        $this->assertSame(fileowner($f), $r->owner);
176
        $this->assertSame(filegroup($f), $r->group);
177
        $this->assertSame('Directory symlink', $r->typename);
178
        $this->assertSame('l', $r->typeflag);
179
        $this->assertSame($f, $r->path);
180
        $this->assertSame(__DIR__, $r->realpath);
181
        $this->assertSame(__DIR__.'/testDirLink', $r->linktarget);
182
183
        if (filetype($f) === 'link') {
184
            $this->assertFalse($r->is_file);
185
            $this->assertTrue($r->is_dir);
186
            $this->assertTrue($r->is_link);
187
        } else {
188
            throw new UnexpectedValueException($f.' type is not "link"');
189
        }
190
    }
191
192
    /**
193
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
194
     */
195 View Code Duplication
    public function testConstructLinkedDir()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
196
    {
197
        $f = __DIR__.'/testDirLink/../'.basename(__DIR__);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
198
199
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
200
201
        $this->assertSame(filesize($f), $r->size);
202
        $this->assertSame(filectime($f), $r->ctime);
203
        $this->assertSame(filemtime($f), $r->mtime);
204
        $this->assertSame(fileperms($f), $r->perms);
205
        $this->assertSame(fileowner($f), $r->owner);
206
        $this->assertSame(filegroup($f), $r->group);
207
        $this->assertSame('Directory', $r->typename);
208
        $this->assertSame('d', $r->typeflag);
209
        $this->assertSame($f, $r->path);
210
        $this->assertSame(__DIR__, $r->realpath);
211
        $this->assertNull($r->linktarget);
212
213
        if (filetype($f) === 'dir') {
214
            $this->assertFalse($r->is_file);
215
            $this->assertTrue($r->is_dir);
216
            $this->assertFalse($r->is_link);
217
        } else {
218
            throw new UnexpectedValueException($f.' type is not "dir"');
219
        }
220
    }
221
222
    /**
223
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
224
     */
225 View Code Duplication
    public function testConstructPipe()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
226
    {
227
        $f = __DIR__.'/testPipe';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
228
229
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
230
231
        $this->assertSame(filesize($f), $r->size);
232
        $this->assertSame(filectime($f), $r->ctime);
233
        $this->assertSame(filemtime($f), $r->mtime);
234
        $this->assertSame(fileperms($f), $r->perms);
235
        $this->assertSame(fileowner($f), $r->owner);
236
        $this->assertSame(filegroup($f), $r->group);
237
        $this->assertSame('Named pipe', $r->typename);
238
        $this->assertSame('p', $r->typeflag);
239
        $this->assertSame($f, $r->path);
240
        $this->assertSame($f, $r->realpath);
241
        $this->assertNull($r->linktarget);
242
243
        if (filetype($f) === 'fifo') {
244
            $this->assertFalse($r->is_file);
245
            $this->assertFalse($r->is_dir);
246
            $this->assertFalse($r->is_link);
247
        } else {
248
            throw new UnexpectedValueException($f.' type is not "fifo"');
249
        }
250
    }
251
252
    /**
253
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
254
     */
255 View Code Duplication
    public function testConstructSocket()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
256
    {
257
        $f = __DIR__.'/testSocket';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
258
259
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
260
261
        $this->assertSame(filesize($f), $r->size);
262
        $this->assertSame(filectime($f), $r->ctime);
263
        $this->assertSame(filemtime($f), $r->mtime);
264
        $this->assertSame(fileperms($f), $r->perms);
265
        $this->assertSame(fileowner($f), $r->owner);
266
        $this->assertSame(filegroup($f), $r->group);
267
        $this->assertSame('Socket', $r->typename);
268
        $this->assertSame('s', $r->typeflag);
269
        $this->assertSame($f, $r->path);
270
        $this->assertSame($f, $r->realpath);
271
        $this->assertNull($r->linktarget);
272
273
        if (filetype($f) === 'socket') {
274
            $this->assertFalse($r->is_file);
275
            $this->assertFalse($r->is_dir);
276
            $this->assertFalse($r->is_link);
277
        } else {
278
            throw new UnexpectedValueException($f.' type is not "socket"');
279
        }
280
    }
281
282
    /**
283
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
284
     */
285 View Code Duplication
    public function testConstructCharacterDevice()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
286
    {
287
        $f = '/dev/null';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
288
289
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
290
291
        $this->assertSame(filesize($f), $r->size);
292
        $this->assertSame(filectime($f), $r->ctime);
293
        $this->assertSame(filemtime($f), $r->mtime);
294
        $this->assertSame(fileperms($f), $r->perms);
295
        $this->assertSame(fileowner($f), $r->owner);
296
        $this->assertSame(filegroup($f), $r->group);
297
        $this->assertSame('Character device', $r->typename);
298
        $this->assertSame('c', $r->typeflag);
299
        $this->assertSame($f, $r->path);
300
        $this->assertSame($f, $r->realpath);
301
        $this->assertNull($r->linktarget);
302
303
        if (filetype($f) === 'char') {
304
            $this->assertFalse($r->is_file);
305
            $this->assertFalse($r->is_dir);
306
            $this->assertFalse($r->is_link);
307
        } else {
308
            throw new UnexpectedValueException($f.' type is not "char"');
309
        }
310
    }
311
312
    /**
313
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
314
     */
315 View Code Duplication
    public function testConstructBlockDevice()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
316
    {
317
        $f = '/dev/blocknull';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $f. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
318
319
        $r = new SplFileInfoRepresentation(new SplFileInfo($f));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
320
321
        $this->assertSame(filesize($f), $r->size);
322
        $this->assertSame(filectime($f), $r->ctime);
323
        $this->assertSame(filemtime($f), $r->mtime);
324
        $this->assertSame(fileperms($f), $r->perms);
325
        $this->assertSame(fileowner($f), $r->owner);
326
        $this->assertSame(filegroup($f), $r->group);
327
        $this->assertSame('Block device', $r->typename);
328
        $this->assertSame('b', $r->typeflag);
329
        $this->assertSame($f, $r->path);
330
        $this->assertSame($f, $r->realpath);
331
        $this->assertNull($r->linktarget);
332
333
        if (filetype($f) === 'block') {
334
            $this->assertFalse($r->is_file);
335
            $this->assertFalse($r->is_dir);
336
            $this->assertFalse($r->is_link);
337
        } else {
338
            throw new UnexpectedValueException($f.' type is not "block"');
339
        }
340
    }
341
342
    /**
343
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
344
     */
345
    public function testConstructNone()
346
    {
347
        $r = new SplFileInfoRepresentation(new SplFileInfo(__FILE__.'/nonexistant'));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
348
349
        $this->assertNull($r->size);
350
        $this->assertNull($r->ctime);
351
        $this->assertNull($r->mtime);
352
        $this->assertNull($r->perms);
353
        $this->assertNull($r->owner);
354
        $this->assertNull($r->group);
355
        $this->assertSame('Unknown file', $r->typename);
356
        $this->assertSame('-', $r->typeflag);
357
        $this->assertNull($r->path);
358
        $this->assertNull($r->realpath);
359
        $this->assertNull($r->linktarget);
360
        $this->assertFalse($r->is_file);
361
        $this->assertFalse($r->is_dir);
362
        $this->assertFalse($r->is_link);
363
    }
364
365
    /**
366
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getLabel
367
     */
368
    public function testGetLabel()
369
    {
370
        $r = new SplFileInfoRepresentation(new SplFileInfo(__FILE__));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
371
372
        $r->typename = 'test123';
373
        $r->size = 1100;
374
375
        $this->assertSame('test123 (1.07KB)', $r->getLabel());
376
    }
377
378
    /**
379
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getSize
380
     */
381
    public function testGetSize()
382
    {
383
        $r = new SplFileInfoRepresentation(new SplFileInfo(__FILE__));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
384
385
        $r->size = 0;
386
        $this->assertNull($r->getSize());
387
388
        $r->size = 42;
389
        $this->assertSame('42B', $r->getSize());
390
391
        $r->size = 1024;
392
        $this->assertSame('1KB', $r->getSize());
393
394
        $r->size = 1100;
395
        $this->assertSame('1.07KB', $r->getSize());
396
397
        $r->size = 1024 * 1024;
398
        $this->assertSame('1MB', $r->getSize());
399
    }
400
401
    /**
402
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getMTime
403
     */
404
    public function testGetMTime()
405
    {
406
        $r = new SplFileInfoRepresentation(new SplFileInfo(__FILE__));
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $r. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
407
        $r->mtime = 0;
408
409
        $this->assertSame('Jan 01 1970', $r->getMTime());
410
411
        $dt = new DateTime('midnight +1 hour +23 minutes');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $dt. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
412
        $r->mtime = $dt->format('U');
413
414
        $this->assertSame(date('M d').' 01:23', $r->getMTime());
415
    }
416
}
417