AppserverIo\Appserver\Application\Application::injectManagers PHP Method

injectManagers() public method

Injects the storage for the managers.
public injectManagers ( AppserverIo\Storage\GenericStackable $managers ) : void
$managers AppserverIo\Storage\GenericStackable The storage for the managers
return void
    public function injectManagers(GenericStackable $managers)
    {
        $this->managers = $managers;
    }

Usage Example

Example #1
0
 /**
  * Initialize the instance to test.
  *
  * @return void
  */
 public function setUp()
 {
     // initialize the application instance
     $this->application = new Application();
     // create a generic stackable for the necessary storages
     $this->managers = new GenericStackable();
     $this->classLoaders = new GenericStackable();
     // create a mock instance of the naming directory
     $this->namingDirectory = new NamingDirectory();
     $this->namingDirectory->setScheme('php');
     $this->namingDirectory->createSubdirectory('php:env');
     $this->namingDirectory->createSubdirectory('php:env/foo');
     $this->namingDirectory->createSubdirectory('php:global');
     $this->namingDirectory->createSubdirectory('php:global/foo');
     $this->namingDirectory->bind('php:env/user', ApplicationTest::USER);
     $this->namingDirectory->bind('php:env/group', ApplicationTest::GROUP);
     $this->namingDirectory->bind('php:env/umask', ApplicationTest::UMASK);
     $this->namingDirectory->bind('php:env/tmpDirectory', ApplicationTest::GLOBAL_TMP_DIR);
     $this->namingDirectory->bind('php:env/foo/webappPath', ApplicationTest::WEBAPP_PATH);
     $this->namingDirectory->bind('php:env/foo/tmpDirectory', ApplicationTest::TMP_DIR);
     $this->namingDirectory->bind('php:env/foo/cacheDirectory', ApplicationTest::CACHE_DIR);
     $this->namingDirectory->bind('php:env/foo/sessionDirectory', ApplicationTest::SESSION_DIR);
     $this->namingDirectory->bind('php:env/baseDirectory', ApplicationTest::BASE_DIRECTORY);
     $this->namingDirectory->bind('php:env/appBase', ApplicationTest::APP_BASE);
     // inject the storages
     $this->application->injectName(ApplicationTest::NAME);
     $this->application->injectManagers($this->managers);
     $this->application->injectClassLoaders($this->classLoaders);
     $this->application->injectNamingDirectory($this->namingDirectory);
 }