|
@@ -54,6 +54,12 @@ class FileLocatorTest extends \PHPUnit_Framework_TestCase
|
|
'->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'
|
|
'->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ $this->assertEquals(
|
|
|
|
+ __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml',
|
|
|
|
+ $loader->locate(__DIR__.'/Fixtures/foo.xml', __DIR__),
|
|
|
|
+ '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'
|
|
|
|
+ );
|
|
|
|
+
|
|
$loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again'));
|
|
$loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again'));
|
|
|
|
|
|
$this->assertEquals(
|
|
$this->assertEquals(
|
|
@@ -61,6 +67,20 @@ class FileLocatorTest extends \PHPUnit_Framework_TestCase
|
|
$loader->locate('foo.xml', __DIR__, false),
|
|
$loader->locate('foo.xml', __DIR__, false),
|
|
'->locate() returns an array of absolute filenames'
|
|
'->locate() returns an array of absolute filenames'
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ $this->assertEquals(
|
|
|
|
+ array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'),
|
|
|
|
+ $loader->locate('foo.xml', __DIR__.'/Fixtures', false),
|
|
|
|
+ '->locate() returns an array of absolute filenames'
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $loader = new FileLocator(__DIR__.'/Fixtures/Again');
|
|
|
|
+
|
|
|
|
+ $this->assertEquals(
|
|
|
|
+ array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'),
|
|
|
|
+ $loader->locate('foo.xml', __DIR__.'/Fixtures', false),
|
|
|
|
+ '->locate() returns an array of absolute filenames'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -72,4 +92,14 @@ class FileLocatorTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
$loader->locate('foobar.xml', __DIR__);
|
|
$loader->locate('foobar.xml', __DIR__);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @expectedException \InvalidArgumentException
|
|
|
|
+ */
|
|
|
|
+ public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath()
|
|
|
|
+ {
|
|
|
|
+ $loader = new FileLocator(array(__DIR__.'/Fixtures'));
|
|
|
|
+
|
|
|
|
+ $loader->locate(__DIR__.'/Fixtures/foobar.xml', __DIR__);
|
|
|
|
+ }
|
|
}
|
|
}
|