Exemple #1
0
 /**
  * Create a fresh mock instance for the given class.
  *
  * @param  string  $name
  * @return \Mockery\Expectation
  */
 protected static function createFreshMockInstance($name)
 {
     static::$instance[$name] = $mock = static::createMockByName($name);
     if (isset(static::$container)) {
         static::$container->instance($name, $mock);
     }
     return $mock;
 }
Exemple #2
0
 /**
  * Get the raw object prior to resolution.
  *
  * @param string $binding The $binding key to get the raw value from.
  *
  * @return Definition|\Closure Value of the $binding.
  */
 public function getRaw($binding)
 {
     if (isset($this->bindings[$binding])) {
         return $this->bindings[$binding];
     } elseif (isset($this->parent)) {
         return $this->parent->getRaw($binding);
     }
     return null;
 }
Exemple #3
0
 /**
  * Register a service provider
  *
  * @param ServiceProvider $provider The service provider object.
  * @param bool $force Force register (register whether needed or not)
  * @param string $binding The binding we're trying to register
  * @return void
  */
 protected function registerProvider(ServiceProvider $provider, $force = false, $binding = null)
 {
     parent::registerProvider($provider, $force, $binding);
     if (!in_array($provider, $this->registered)) {
         return;
     }
     if ($this->booted) {
         if (method_exists($provider, 'boot')) {
             $provider->boot();
         }
     }
 }