Exemple #1
0
 /**
  * @covers Symfony\Components\DependencyInjection\Loader\Loader::resolve
  */
 public function testResolve()
 {
     $container = new ContainerBuilder();
     $resolver = new LoaderResolver(array($ini = new IniFileLoader($container, array())));
     $loader = new ProjectLoader1($container);
     $loader->setResolver($resolver);
     $this->assertSame($ini, $loader->resolve('foo.ini'), '->resolve() finds a loader');
     $this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader');
     try {
         $loader->resolve(new \stdClass());
         $this->fail('->resolve() throws an \\InvalidArgumentException if the resource cannot be loaded');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\InvalidArgumentException', $e, '->resolve() throws an \\InvalidArgumentException if the resource cannot be loaded');
     }
 }
Exemple #2
0
 public function testExtension()
 {
     ProjectLoader1::registerExtension($extension = new \ProjectExtension());
     $this->assertTrue(ProjectLoader1::getExtension('project') === $extension, '::registerExtension() registers an extension');
 }