@@ -98,7 +98,7 @@ public function testGetServiceIds()
9898 $ this  ->assertEquals (array ('service_container ' , 'foo ' , 'bar ' ), $ sc ->getServiceIds (), '->getServiceIds() returns all defined service ids ' );
9999
100100 $ sc  = new  ProjectServiceContainer ();
101-  $ this  ->assertEquals (array ('scoped ' , 'scoped_foo ' , 'bar ' , 'foo_bar ' , 'foo.baz ' , 'circular ' , 'throw_exception ' , 'service_container ' ), $ sc ->getServiceIds (), '->getServiceIds() returns defined service ids by getXXXService() methods ' );
101+  $ this  ->assertEquals (array ('scoped ' , 'scoped_foo ' , 'bar ' , 'foo_bar ' , 'foo.baz ' , 'circular ' , 'throw_exception ' , 'throws_exception_on_service_configuration '  ,  ' service_container ' ), $ sc ->getServiceIds (), '->getServiceIds() returns defined service ids by getXXXService() methods ' );
102102 }
103103
104104 /** 
@@ -367,6 +367,25 @@ public function testGetThrowsException()
367367 }
368368 }
369369
370+  public  function  testGetThrowsExceptionOnServiceConfiguration ()
371+  {
372+  $ c  = new  ProjectServiceContainer ();
373+ 
374+  try  {
375+  $ c ->get ('throws_exception_on_service_configuration ' );
376+  $ this  ->fail ('The container can not contain invalid service! ' );
377+  } catch  (\Exception   $ e ) {
378+  $ this  ->assertEquals ('Something was terribly wrong while trying to configure the service! ' , $ e ->getMessage ());
379+  }
380+ 
381+  try  {
382+  $ c ->get ('throws_exception_on_service_configuration ' );
383+  $ this  ->fail ('The container can not contain invalid service! ' );
384+  } catch  (\Exception   $ e ) {
385+  $ this  ->assertEquals ('Something was terribly wrong while trying to configure the service! ' , $ e ->getMessage ());
386+  }
387+  }
388+ 
370389 public  function  getInvalidParentScopes ()
371390 {
372391 return  array (
@@ -447,4 +466,13 @@ protected function getThrowExceptionService()
447466 {
448467 throw  new  \Exception ('Something went terribly wrong! ' );
449468 }
469+ 
470+  protected  function  getThrowsExceptionOnServiceConfigurationService ()
471+  {
472+  $ this  ->services ['throws_exception_on_service_configuration ' ] = $ instance  = new  \stdClass ();
473+ 
474+  throw  new  \Exception ('Something was terribly wrong while trying to configure the service! ' );
475+ 
476+  return  $ instance ;
477+  }
450478}
0 commit comments