public function testMultipleExtends()
 {
     $container = new Container();
     $container['foo'] = 'foo';
     $container->extend('foo', function ($old, $container) {
         return $old . 'bar';
     });
     $container->extend('foo', function ($old, $container) {
         return $old . 'baz';
     });
     $this->assertEquals('foobarbaz', $container->make('foo'));
 }
Exemple #2
0
 /**
  * Resolve the given type from the container.
  *
  * (Overriding Container::make)
  *
  * @param  string  $abstract
  * @return mixed
  */
 public function make($abstract)
 {
     if (isset($this->deferredServices[$abstract])) {
         $this->loadDeferredProvider($abstract);
     }
     return parent::make($abstract);
 }