Esempio n. 1
0
 /**
  * @covers Symfony\Component\DependencyInjection\Container::__call
  */
 public function testGetCall()
 {
     $sc = new Container();
     $sc->set('foo_bar.foo', $foo = new \stdClass());
     $this->assertEquals($foo, $sc->getFooBar_FooService(), '__call() finds services is the method is getXXXService()');
     try {
         $sc->getFooBar_Foo();
         $this->fail('__call() throws a \\BadMethodCallException exception if the method is not a service method');
     } catch (\Exception $e) {
         $this->assertInstanceOf('\\BadMethodCallException', $e, '__call() throws a \\BadMethodCallException exception if the method is not a service method');
         $this->assertEquals('Call to undefined method Symfony\\Component\\DependencyInjection\\Container::getFooBar_Foo.', $e->getMessage(), '__call() throws a \\BadMethodCallException exception if the method is not a service method');
     }
 }