Esempio n. 1
0
 public function testGetAbsolutePath()
 {
     $loader = new ProjectLoader(array(__DIR__ . '/../../../../../fixtures/Symfony/Components/DependencyInjection/containers'));
     $this->assertEquals($loader->getAbsolutePath('/foo.xml'), '/foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals($loader->getAbsolutePath('c:\\\\foo.xml'), 'c:\\\\foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals($loader->getAbsolutePath('c:/foo.xml'), 'c:/foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals($loader->getAbsolutePath('\\server\\foo.xml'), '\\server\\foo.xml', '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals($loader->getAbsolutePath('FileLoaderTest.php', __DIR__), __DIR__ . '/FileLoaderTest.php', '->getAbsolutePath() returns an absolute filename if the file exists in the current path');
     $this->assertEquals($loader->getAbsolutePath('container10.php', __DIR__), __DIR__ . '/../../../../../fixtures/Symfony/Components/DependencyInjection/containers/container10.php', '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');
     $this->assertEquals($loader->getAbsolutePath('foo.xml', __DIR__), 'foo.xml', '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
 }
Esempio n. 2
0
 /**
  * @covers Symfony\Components\DependencyInjection\Loader\FileLoader::GetAbsolutePath
  */
 public function testGetAbsolutePath()
 {
     $loader = new ProjectLoader(new ContainerBuilder(), array(__DIR__ . '/../Fixtures/containers'));
     $this->assertEquals('/foo.xml', $loader->getAbsolutePath('/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals('c:\\\\foo.xml', $loader->getAbsolutePath('c:\\\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals('c:/foo.xml', $loader->getAbsolutePath('c:/foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals('\\server\\foo.xml', $loader->getAbsolutePath('\\server\\foo.xml'), '->getAbsolutePath() return the path unmodified if it is already an absolute path');
     $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'FileLoaderTest.php', $loader->getAbsolutePath('FileLoaderTest.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in the current path');
     $this->assertEquals(__DIR__ . '/../Fixtures/containers' . DIRECTORY_SEPARATOR . 'container10.php', $loader->getAbsolutePath('container10.php', __DIR__), '->getAbsolutePath() returns an absolute filename if the file exists in one of the paths given in the constructor');
     $this->assertEquals('foo.xml', $loader->getAbsolutePath('foo.xml', __DIR__), '->getAbsolutePath() returns the path unmodified if it is unable to find it in the given paths');
 }