|
@@ 190-215 (lines=26) @@
|
| 187 |
|
/** |
| 188 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 189 |
|
*/ |
| 190 |
|
public function testConstructLinkedDir() |
| 191 |
|
{ |
| 192 |
|
$f = __DIR__.'/testDirLink/'.basename(__DIR__); |
| 193 |
|
|
| 194 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 195 |
|
|
| 196 |
|
$this->assertSame(filesize($f), $r->size); |
| 197 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 198 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 199 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 200 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 201 |
|
$this->assertSame(filegroup($f), $r->group); |
| 202 |
|
$this->assertSame('Directory', $r->typename); |
| 203 |
|
$this->assertSame('d', $r->typeflag); |
| 204 |
|
$this->assertSame($f, $r->path); |
| 205 |
|
$this->assertSame(__DIR__, $r->realpath); |
| 206 |
|
$this->assertNull($r->linktarget); |
| 207 |
|
|
| 208 |
|
if (filetype($f) === 'dir') { |
| 209 |
|
$this->assertFalse($r->is_file); |
| 210 |
|
$this->assertTrue($r->is_dir); |
| 211 |
|
$this->assertFalse($r->is_link); |
| 212 |
|
} else { |
| 213 |
|
throw new UnexpectedValueException($f.' type is not "dir"'); |
| 214 |
|
} |
| 215 |
|
} |
| 216 |
|
|
| 217 |
|
/** |
| 218 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
|
@@ 220-245 (lines=26) @@
|
| 217 |
|
/** |
| 218 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 219 |
|
*/ |
| 220 |
|
public function testConstructPipe() |
| 221 |
|
{ |
| 222 |
|
$f = __DIR__.'/testPipe'; |
| 223 |
|
|
| 224 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 225 |
|
|
| 226 |
|
$this->assertSame(filesize($f), $r->size); |
| 227 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 228 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 229 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 230 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 231 |
|
$this->assertSame(filegroup($f), $r->group); |
| 232 |
|
$this->assertSame('Named pipe', $r->typename); |
| 233 |
|
$this->assertSame('p', $r->typeflag); |
| 234 |
|
$this->assertSame($f, $r->path); |
| 235 |
|
$this->assertSame($f, $r->realpath); |
| 236 |
|
$this->assertNull($r->linktarget); |
| 237 |
|
|
| 238 |
|
if (filetype($f) === 'fifo') { |
| 239 |
|
$this->assertFalse($r->is_file); |
| 240 |
|
$this->assertFalse($r->is_dir); |
| 241 |
|
$this->assertFalse($r->is_link); |
| 242 |
|
} else { |
| 243 |
|
throw new UnexpectedValueException($f.' type is not "fifo"'); |
| 244 |
|
} |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
/** |
| 248 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
|
@@ 250-275 (lines=26) @@
|
| 247 |
|
/** |
| 248 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 249 |
|
*/ |
| 250 |
|
public function testConstructSocket() |
| 251 |
|
{ |
| 252 |
|
$f = __DIR__.'/testSocket'; |
| 253 |
|
|
| 254 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 255 |
|
|
| 256 |
|
$this->assertSame(filesize($f), $r->size); |
| 257 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 258 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 259 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 260 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 261 |
|
$this->assertSame(filegroup($f), $r->group); |
| 262 |
|
$this->assertSame('Socket', $r->typename); |
| 263 |
|
$this->assertSame('s', $r->typeflag); |
| 264 |
|
$this->assertSame($f, $r->path); |
| 265 |
|
$this->assertSame($f, $r->realpath); |
| 266 |
|
$this->assertNull($r->linktarget); |
| 267 |
|
|
| 268 |
|
if (filetype($f) === 'socket') { |
| 269 |
|
$this->assertFalse($r->is_file); |
| 270 |
|
$this->assertFalse($r->is_dir); |
| 271 |
|
$this->assertFalse($r->is_link); |
| 272 |
|
} else { |
| 273 |
|
throw new UnexpectedValueException($f.' type is not "socket"'); |
| 274 |
|
} |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
/** |
| 278 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
|
@@ 280-305 (lines=26) @@
|
| 277 |
|
/** |
| 278 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |
| 279 |
|
*/ |
| 280 |
|
public function testConstructCharacterDevice() |
| 281 |
|
{ |
| 282 |
|
$f = '/dev/null'; |
| 283 |
|
|
| 284 |
|
$r = new SplFileInfoRepresentation(new SplFileInfo($f)); |
| 285 |
|
|
| 286 |
|
$this->assertSame(filesize($f), $r->size); |
| 287 |
|
$this->assertSame(filectime($f), $r->ctime); |
| 288 |
|
$this->assertSame(filemtime($f), $r->mtime); |
| 289 |
|
$this->assertSame(fileperms($f), $r->perms); |
| 290 |
|
$this->assertSame(fileowner($f), $r->owner); |
| 291 |
|
$this->assertSame(filegroup($f), $r->group); |
| 292 |
|
$this->assertSame('Character device', $r->typename); |
| 293 |
|
$this->assertSame('c', $r->typeflag); |
| 294 |
|
$this->assertSame($f, $r->path); |
| 295 |
|
$this->assertSame($f, $r->realpath); |
| 296 |
|
$this->assertNull($r->linktarget); |
| 297 |
|
|
| 298 |
|
if (filetype($f) === 'char') { |
| 299 |
|
$this->assertFalse($r->is_file); |
| 300 |
|
$this->assertFalse($r->is_dir); |
| 301 |
|
$this->assertFalse($r->is_link); |
| 302 |
|
} else { |
| 303 |
|
throw new UnexpectedValueException($f.' type is not "char"'); |
| 304 |
|
} |
| 305 |
|
} |
| 306 |
|
|
| 307 |
|
/** |
| 308 |
|
* @covers \Kint\Object\Representation\SplFileInfoRepresentation::__construct |