-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
Seems like is_dir()
does not work with a virtual directory. My guess is something is not completely correct with the value of $directory->getMode()
, but I'm not sure.
Test case to reproduce the issue
<?php
namespace Vfs;
use Vfs\Node\Directory;
use Vfs\Node\File;
class PHPFileFunctionsTest extends \PHPUnit_Framework_TestCase
{
const SCHEME = 'foobar://';
/**
* @var FileSystem
*/
private $fs;
public function setUp()
{
$fs = FileSystem::factory( self::SCHEME );
$someDir = new Directory( array( 'file' => new File( 'foobar' ) ) );
$fs->get( '/' )->add( 'some_dir', $someDir );
$this->fs = $fs;
}
public function tearDown()
{
$this->fs->unmount();
unset( $this->fs );
}
public function testFileGetContentsWorks()
{
$path = self::SCHEME . 'some_dir/file';
$this->assertEquals( 'foobar', file_get_contents( $path ) );
}
public function testIsDirWorks()
{
$path = self::SCHEME . 'some_dir';
$this->assertTrue( is_dir( $path ) );
}
}
Output from running PHPUnit:
There was 1 failure:
1) Vfs\PHPFileFunctionsTest::testIsDirWorks
Failed asserting that false is true.
/home/vagrant/src/github/vfs.php/test/unit/PHPFileFunctionsTest.php:46
FAILURES!
Tests: 163, Assertions: 379, Failures: 1.
Metadata
Metadata
Assignees
Labels
No labels