Test Setup Failed
Push — test ( 71734b...8babba )
by Jonathan
03:40
created

testConstructLinkedFile()   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
nc 2
nop 0
dl 26
loc 26
rs 8.8571
c 1
b 0
f 0
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
        posix_mkfifo(__DIR__.'/mkfifo', 0777);
22
        $this->socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
23
    }
24
25
    public function tearDown()
26
    {
27
        unlink(__DIR__.'/testDirLink2');
28
        unlink(__DIR__.'/testFileLink2');
29
        unlink(__DIR__.'/testDirLink');
30
        unlink(__DIR__.'/testFileLink');
31
        unlink(__DIR__.'/mkfifo');
32
        socket_close($this->socket);
33
    }
34
35
    /**
36
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
37
     */
38 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...
39
    {
40
        $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...
41
42
        $this->assertSame(filesize(__FILE__), $r->size);
43
        $this->assertSame(filectime(__FILE__), $r->ctime);
44
        $this->assertSame(filemtime(__FILE__), $r->mtime);
45
        $this->assertSame(fileperms(__FILE__), $r->perms);
46
        $this->assertSame(fileowner(__FILE__), $r->owner);
47
        $this->assertSame(filegroup(__FILE__), $r->group);
48
        $this->assertSame('File', $r->typename);
49
        $this->assertSame('-', $r->typeflag);
50
        $this->assertSame(__FILE__, $r->path);
51
        $this->assertSame(__FILE__, $r->realpath);
52
        $this->assertNull($r->linktarget);
53
54
        if (filetype(__FILE__) === 'file') {
55
            $this->assertTrue($r->is_file);
56
            $this->assertFalse($r->is_dir);
57
            $this->assertFalse($r->is_link);
58
        } else {
59
            throw new UnexpectedValueException(__FILE__.' type is not "file"');
60
        }
61
    }
62
63
    /**
64
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
65
     */
66 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...
67
    {
68
        $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...
69
70
        $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...
71
72
        $this->assertSame(filesize($f), $r->size);
73
        $this->assertSame(filectime($f), $r->ctime);
74
        $this->assertSame(filemtime($f), $r->mtime);
75
        $this->assertSame(fileperms($f), $r->perms);
76
        $this->assertSame(fileowner($f), $r->owner);
77
        $this->assertSame(filegroup($f), $r->group);
78
        $this->assertSame('File symlink', $r->typename);
79
        $this->assertSame('l', $r->typeflag);
80
        $this->assertSame($f, $r->path);
81
        $this->assertSame(__FILE__, $r->realpath);
82
        $this->assertSame(__DIR__.'/testFileLink', $r->linktarget);
83
84
        if (filetype($f) === 'link') {
85
            $this->assertTrue($r->is_link);
86
            $this->assertTrue($r->is_file);
87
            $this->assertFalse($r->is_dir);
88
        } else {
89
            throw new UnexpectedValueException($f.' type is not "link"');
90
        }
91
    }
92
93
    /**
94
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
95
     */
96 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...
97
    {
98
        $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...
99
100
        $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...
101
102
        $this->assertSame(filesize($f), $r->size);
103
        $this->assertSame(filectime($f), $r->ctime);
104
        $this->assertSame(filemtime($f), $r->mtime);
105
        $this->assertSame(fileperms($f), $r->perms);
106
        $this->assertSame(fileowner($f), $r->owner);
107
        $this->assertSame(filegroup($f), $r->group);
108
        $this->assertSame('File', $r->typename);
109
        $this->assertSame('-', $r->typeflag);
110
        $this->assertSame($f, $r->path);
111
        $this->assertSame(__FILE__, $r->realpath);
112
        $this->assertNull($r->linktarget);
113
114
        if (filetype($f) === 'file') {
115
            $this->assertTrue($r->is_file);
116
            $this->assertFalse($r->is_link);
117
            $this->assertFalse($r->is_dir);
118
        } else {
119
            throw new UnexpectedValueException($f.' type is not "file"');
120
        }
121
    }
122
123
    /**
124
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
125
     */
126 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...
127
    {
128
        $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...
129
130
        $this->assertSame(filesize(__DIR__), $r->size);
131
        $this->assertSame(filectime(__DIR__), $r->ctime);
132
        $this->assertSame(filemtime(__DIR__), $r->mtime);
133
        $this->assertSame(fileperms(__DIR__), $r->perms);
134
        $this->assertSame(fileowner(__DIR__), $r->owner);
135
        $this->assertSame(filegroup(__DIR__), $r->group);
136
        $this->assertSame('Directory', $r->typename);
137
        $this->assertSame('d', $r->typeflag);
138
        $this->assertSame(__DIR__, $r->path);
139
        $this->assertSame(__DIR__, $r->realpath);
140
        $this->assertNull($r->linktarget);
141
142
        if (filetype(__DIR__) === 'dir') {
143
            $this->assertTrue($r->is_dir);
144
            $this->assertFalse($r->is_file);
145
            $this->assertFalse($r->is_link);
146
        } else {
147
            throw new UnexpectedValueException(__DIR__.' type is not "dir"');
148
        }
149
    }
150
151
    /**
152
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
153
     */
154 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...
155
    {
156
        $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...
157
158
        $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...
159
160
        $this->assertSame(filesize($f), $r->size);
161
        $this->assertSame(filectime($f), $r->ctime);
162
        $this->assertSame(filemtime($f), $r->mtime);
163
        $this->assertSame(fileperms($f), $r->perms);
164
        $this->assertSame(fileowner($f), $r->owner);
165
        $this->assertSame(filegroup($f), $r->group);
166
        $this->assertSame('Directory symlink', $r->typename);
167
        $this->assertSame('l', $r->typeflag);
168
        $this->assertSame($f, $r->path);
169
        $this->assertSame(__DIR__, $r->realpath);
170
        $this->assertSame(__DIR__.'/testDirLink', $r->linktarget);
171
172
        if (filetype($f) === 'link') {
173
            $this->assertTrue($r->is_link);
174
            $this->assertTrue($r->is_dir);
175
            $this->assertFalse($r->is_file);
176
        } else {
177
            throw new UnexpectedValueException($f.' type is not "link"');
178
        }
179
    }
180
181
    /**
182
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
183
     */
184 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...
185
    {
186
        $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...
187
188
        $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...
189
190
        $this->assertSame(filesize($f), $r->size);
191
        $this->assertSame(filectime($f), $r->ctime);
192
        $this->assertSame(filemtime($f), $r->mtime);
193
        $this->assertSame(fileperms($f), $r->perms);
194
        $this->assertSame(fileowner($f), $r->owner);
195
        $this->assertSame(filegroup($f), $r->group);
196
        $this->assertSame('Directory', $r->typename);
197
        $this->assertSame('d', $r->typeflag);
198
        $this->assertSame($f, $r->path);
199
        $this->assertSame(__DIR__, $r->realpath);
200
        $this->assertNull($r->linktarget);
201
202
        if (filetype($f) === 'dir') {
203
            $this->assertTrue($r->is_dir);
204
            $this->assertFalse($r->is_link);
205
            $this->assertFalse($r->is_file);
206
        } else {
207
            throw new UnexpectedValueException($f.' type is not "dir"');
208
        }
209
    }
210
211
    /**
212
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
213
     */
214 View Code Duplication
    public function testConstructCharacterSpecial()
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...
215
    {
216
        $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...
217
218
        $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...
219
220
        $this->assertSame(filesize($f), $r->size);
221
        $this->assertSame(filectime($f), $r->ctime);
222
        $this->assertSame(filemtime($f), $r->mtime);
223
        $this->assertSame(fileperms($f), $r->perms);
224
        $this->assertSame(fileowner($f), $r->owner);
225
        $this->assertSame(filegroup($f), $r->group);
226
        $this->assertSame('Character device', $r->typename);
227
        $this->assertSame('c', $r->typeflag);
228
        $this->assertSame($f, $r->path);
229
        $this->assertSame($f, $r->realpath);
230
        $this->assertNull($r->linktarget);
231
232
        if (filetype($f) === 'char') {
233
            $this->assertFalse($r->is_file);
234
            $this->assertFalse($r->is_dir);
235
            $this->assertFalse($r->is_link);
236
        } else {
237
            throw new UnexpectedValueException($f.' type is not "char"');
238
        }
239
    }
240
241
    /**
242
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
243
     */
244 View Code Duplication
    public function testConstructBlockSpecial()
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...
245
    {
246
        $f = '/dev/loop0';
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...
247
248
        $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...
249
250
        $this->assertSame(filesize($f), $r->size);
251
        $this->assertSame(filectime($f), $r->ctime);
252
        $this->assertSame(filemtime($f), $r->mtime);
253
        $this->assertSame(fileperms($f), $r->perms);
254
        $this->assertSame(fileowner($f), $r->owner);
255
        $this->assertSame(filegroup($f), $r->group);
256
        $this->assertSame('Block device', $r->typename);
257
        $this->assertSame('b', $r->typeflag);
258
        $this->assertSame($f, $r->path);
259
        $this->assertSame($f, $r->realpath);
260
        $this->assertNull($r->linktarget);
261
262
        if (filetype($f) === 'block') {
263
            $this->assertFalse($r->is_file);
264
            $this->assertFalse($r->is_dir);
265
            $this->assertFalse($r->is_link);
266
        } else {
267
            throw new UnexpectedValueException($f.' type is not "block"');
268
        }
269
    }
270
271
    /**
272
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
273
     */
274 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...
275
    {
276
        $f = '/proc/'.getmypid().'/fd/3';
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...
277
278
        $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...
279
280
        $this->assertSame(filesize($f), $r->size);
281
        $this->assertSame(filectime($f), $r->ctime);
282
        $this->assertSame(filemtime($f), $r->mtime);
283
        $this->assertSame(fileperms($f), $r->perms);
284
        $this->assertSame(fileowner($f), $r->owner);
285
        $this->assertSame(filegroup($f), $r->group);
286
        $this->assertSame('Socket', $r->typename);
287
        $this->assertSame('s', $r->typeflag);
288
        $this->assertSame($f, $r->path);
289
        $this->assertFalse($r->realpath);
290
        $this->assertRegExp('/^socket:\[[0-9]+\]$/', $r->linktarget);
291
292
        if (filetype($f) === 'link') {
293
            $this->assertTrue($r->is_link);
294
            $this->assertFalse($r->is_file);
295
            $this->assertFalse($r->is_dir);
296
        } else {
297
            throw new UnexpectedValueException($f.' type is not "link"');
298
        }
299
    }
300
301
    /**
302
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
303
     */
304 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...
305
    {
306
        $f = __DIR__.'/mkfifo';
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...
307
308
        $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...
309
310
        $this->assertSame(filesize($f), $r->size);
311
        $this->assertSame(filectime($f), $r->ctime);
312
        $this->assertSame(filemtime($f), $r->mtime);
313
        $this->assertSame(fileperms($f), $r->perms);
314
        $this->assertSame(fileowner($f), $r->owner);
315
        $this->assertSame(filegroup($f), $r->group);
316
        $this->assertSame('Named pipe', $r->typename);
317
        $this->assertSame('p', $r->typeflag);
318
        $this->assertSame($f, $r->path);
319
        $this->assertSame($f, $r->realpath);
320
        $this->assertNull($r->linktarget);
321
322
        if (filetype($f) === 'fifo') {
323
            $this->assertFalse($r->is_link);
324
            $this->assertFalse($r->is_file);
325
            $this->assertFalse($r->is_dir);
326
        } else {
327
            throw new UnexpectedValueException($f.' type is not "fifo"');
328
        }
329
    }
330
331
    /**
332
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct
333
     */
334
    public function testConstructNone()
335
    {
336
        $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...
337
338
        $this->assertNull($r->size);
339
        $this->assertNull($r->ctime);
340
        $this->assertNull($r->mtime);
341
        $this->assertNull($r->perms);
342
        $this->assertNull($r->owner);
343
        $this->assertNull($r->group);
344
        $this->assertSame('Unknown file', $r->typename);
345
        $this->assertSame('-', $r->typeflag);
346
        $this->assertNull($r->path);
347
        $this->assertNull($r->realpath);
348
        $this->assertNull($r->linktarget);
349
        $this->assertFalse($r->is_dir);
350
        $this->assertFalse($r->is_file);
351
        $this->assertFalse($r->is_link);
352
    }
353
354
    /**
355
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getLabel
356
     */
357
    public function testGetLabel()
358
    {
359
        $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...
360
361
        $r->typename = 'test123';
362
        $r->size = 1100;
363
364
        $this->assertSame('test123 (1.07KB)', $r->getLabel());
365
    }
366
367
    /**
368
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getSize
369
     */
370
    public function testGetSize()
371
    {
372
        $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...
373
374
        $r->size = 0;
375
        $this->assertNull($r->getSize());
376
377
        $r->size = 42;
378
        $this->assertSame('42B', $r->getSize());
379
380
        $r->size = 1024;
381
        $this->assertSame('1KB', $r->getSize());
382
383
        $r->size = 1100;
384
        $this->assertSame('1.07KB', $r->getSize());
385
386
        $r->size = 1024 * 1024;
387
        $this->assertSame('1MB', $r->getSize());
388
    }
389
390
    /**
391
     * @covers \Kint\Object\Representation\SplFileInfoRepresentation::getMTime
392
     */
393
    public function testGetMTime()
394
    {
395
        $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...
396
        $r->mtime = 0;
397
398
        $this->assertSame('Jan 01 1970', $r->getMTime());
399
400
        $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...
401
        $r->mtime = $dt->format('U');
402
403
        $this->assertSame(date('M d').' 01:23', $r->getMTime());
404
    }
405
}
406