[Config] Loader::import must return imported data

This commit is contained in:
Martin Hasoň 2012-12-07 14:24:02 +01:00
parent aad8136cd1
commit 8bb3208ab8
2 changed files with 12 additions and 1 deletions

View File

@ -47,10 +47,12 @@ abstract class Loader implements LoaderInterface
* *
* @param mixed $resource A Resource * @param mixed $resource A Resource
* @param string $type The resource type * @param string $type The resource type
*
* @return mixed
*/ */
public function import($resource, $type = null) public function import($resource, $type = null)
{ {
$this->resolve($resource)->load($resource, $type); return $this->resolve($resource)->load($resource, $type);
} }
/** /**

View File

@ -55,6 +55,15 @@ class LoaderTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderLoadException', $e, '->resolve() throws a FileLoaderLoadException if the resource cannot be loaded'); $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderLoadException', $e, '->resolve() throws a FileLoaderLoadException if the resource cannot be loaded');
} }
} }
public function testImport()
{
$loader = $this->getMock('Symfony\Component\Config\Loader\Loader', array('supports', 'load'));
$loader->expects($this->once())->method('supports')->will($this->returnValue(true));
$loader->expects($this->once())->method('load')->will($this->returnValue('yes'));
$this->assertEquals('yes', $loader->import('foo'));
}
} }
class ProjectLoader1 extends Loader class ProjectLoader1 extends Loader