Beispiel #1
0
 public function testDiContainerShareShouldReturnAlwaysTheSameObjectEvenIfItIsAClosure()
 {
     $dic = new DIContainer();
     $dic['shared_service'] = $dic->share(function () {
         return new Service();
     });
     $serviceOne = $dic['shared_service'];
     $this->assertInstanceOf('Aliegon\\Tests\\DependencyInjection\\Service', $serviceOne);
     $serviceTwo = $dic['shared_service'];
     $this->assertInstanceOf('Aliegon\\Tests\\DependencyInjection\\Service', $serviceTwo);
     $this->assertSame($serviceOne, $serviceTwo);
 }
Beispiel #2
0
 /**
  * Starts the Loader and loads the right object in base of the routing
  *
  * @return void
  */
 public function run()
 {
     $this->loadRouting();
     $this->container->get('loader')->run();
 }