|
@@ 102-127 (lines=26) @@
|
| 99 |
|
/** |
| 100 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 101 |
|
*/ |
| 102 |
|
public function testConstructLinkedFile() |
| 103 |
|
{ |
| 104 |
|
$f = __DIR__.'/testDirLink/'.basename(__DIR__).'/'.basename(__FILE__); |
| 105 |
|
|
| 106 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 107 |
|
|
| 108 |
|
$this->assertSame(filesize($f), $r->size); |
| 109 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 110 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 111 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 112 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 113 |
|
$this->assertSame(filegroup($f), $r->group); |
| 114 |
|
$this->assertSame('File', $r->typename); |
| 115 |
|
$this->assertSame('-', $r->typeflag); |
| 116 |
|
$this->assertSame($f, $r->path); |
| 117 |
|
$this->assertSame(__FILE__, $r->realpath); |
| 118 |
|
$this->assertNull($r->linktarget); |
| 119 |
|
|
| 120 |
|
if (filetype($f) === 'file') { |
| 121 |
|
$this->assertTrue($r->is_file); |
| 122 |
|
$this->assertFalse($r->is_dir); |
| 123 |
|
$this->assertFalse($r->is_link); |
| 124 |
|
} else { |
| 125 |
|
throw new UnexpectedValueException($f.' type is not "file"'); |
| 126 |
|
} |
| 127 |
|
} |
| 128 |
|
|
| 129 |
|
/** |
| 130 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
|
@@ 160-185 (lines=26) @@
|
| 157 |
|
/** |
| 158 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 159 |
|
*/ |
| 160 |
|
public function testConstructDirLink() |
| 161 |
|
{ |
| 162 |
|
$f = __DIR__.'/testDirLink2'; |
| 163 |
|
|
| 164 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 165 |
|
|
| 166 |
|
$this->assertSame(filesize($f), $r->size); |
| 167 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 168 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 169 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 170 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 171 |
|
$this->assertSame(filegroup($f), $r->group); |
| 172 |
|
$this->assertSame('Directory symlink', $r->typename); |
| 173 |
|
$this->assertSame('l', $r->typeflag); |
| 174 |
|
$this->assertSame($f, $r->path); |
| 175 |
|
$this->assertSame(dirname(__DIR__), $r->realpath); |
| 176 |
|
$this->assertSame(__DIR__.'/testDirLink', $r->linktarget); |
| 177 |
|
|
| 178 |
|
if (filetype($f) === 'link') { |
| 179 |
|
$this->assertFalse($r->is_file); |
| 180 |
|
$this->assertTrue($r->is_dir); |
| 181 |
|
$this->assertTrue($r->is_link); |
| 182 |
|
} else { |
| 183 |
|
throw new UnexpectedValueException($f.' type is not "link"'); |
| 184 |
|
} |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
/** |
| 188 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |