Nette\DI\Container::removeService PHP Method

removeService() public method

Removes the service from the container.
public removeService ( $name ) : void
return void
    public function removeService($name)
    {
        $name = isset($this->meta[self::ALIASES][$name]) ? $this->meta[self::ALIASES][$name] : $name;
        unset($this->registry[$name]);
    }

Usage Example

コード例 #1
0
ファイル: Login.php プロジェクト: CSHH/website
 public function signIn(Nette\DI\Container $container)
 {
     $container->removeService('nette.userStorage');
     $userStorage = m::mock('Nette\\Security\\IUserStorage');
     $userStorage->shouldReceive('isAuthenticated')->once()->andReturn(true);
     $userStorage->shouldReceive('getIdentity')->once()->andReturn(new Nette\Security\Identity(1));
     $container->addService('nette.userStorage', $userStorage);
 }
All Usage Examples Of Nette\DI\Container::removeService