/** * Create a new (non-interactive) embedded application (e.g. for running * single commands). * * @param SessionInterface $session * * @return EmbeddedApplication */ public static function createEmbeddedApplication(SessionInterface $session) { $container = new Container(self::MODE_EMBEDDED_COMMAND); $container->get('phpcr.session_manager')->setSession(new PhpcrSession($session)); $application = $container->get('application'); return $application; }
/** * Constructor - add the single command ShellCommand which * accepts the connection parameters for the shell. */ public function __construct() { parent::__construct(PhpcrShell::APP_NAME, PhpcrShell::APP_VERSION); $container = new Container(); $this->shellApplication = $container->get('application'); $command = new ShellCommand($this->shellApplication); $command->setApplication($this); $this->add($command); }
protected function createTester() { // embbed a new session $session = $this->getSession(null, true); $container = new Container(PhpcrShell::MODE_EMBEDDED_SHELL); $container->get('phpcr.session_manager')->setSession(new PhpcrSession($session)); $application = $container->get('application'); $application->setShowUnsupported(true); $tester = new ApplicationTester($application); return $tester; }