AppserverIo\Appserver\Application\ApplicationTest::setUp PHP Метод

setUp() публичный Метод

Initialize the instance to test.
public setUp ( ) : void
Результат 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/baseDirectory', ApplicationTest::BASE_DIRECTORY);
        $this->namingDirectory->bind(sprintf('php:env/%s/%s/webappPath', ApplicationTest::CONTAINER_NAME, ApplicationTest::NAME), ApplicationTest::WEBAPP_PATH);
        $this->namingDirectory->bind(sprintf('php:env/%s/%s/tmpDirectory', ApplicationTest::CONTAINER_NAME, ApplicationTest::NAME), ApplicationTest::TMP_DIR);
        $this->namingDirectory->bind(sprintf('php:env/%s/%s/cacheDirectory', ApplicationTest::CONTAINER_NAME, ApplicationTest::NAME), ApplicationTest::CACHE_DIR);
        $this->namingDirectory->bind(sprintf('php:env/%s/%s/sessionDirectory', ApplicationTest::CONTAINER_NAME, ApplicationTest::NAME), ApplicationTest::SESSION_DIR);
        $this->namingDirectory->bind(sprintf('php:env/%s/%s/appBase', ApplicationTest::CONTAINER_NAME, ApplicationTest::NAME), ApplicationTest::APP_BASE);
        // inject the storages
        $this->application->injectName(ApplicationTest::NAME);
        $this->application->injectContainerName(ApplicationTest::CONTAINER_NAME);
        $this->application->injectManagers($this->managers);
        $this->application->injectClassLoaders($this->classLoaders);
        $this->application->injectNamingDirectory($this->namingDirectory);
    }