Example #1
0
 public function setup()
 {
     parent::setup();
     $this->controller = $this->prophesize("Ethna_Controller");
     $this->event_dispatcher = $this->prophesize('\\Symfony\\Component\\EventDispatcher\\EventDispatcher');
     $this->backend = $this->prophesize("Ethna_Backend");
     $this->i18n = $this->prophesize("Ethna_I18N");
     $this->action_error = $this->prophesize("Ethna_ActionError");
     $this->plugin = $this->prophesize("Ethna_Plugin");
     $this->logger = $this->prophesize("Ethna_Logger");
     $this->controller->getEventDispatcher()->willReturn($this->event_dispatcher);
     $this->event_dispatcher->dispatch(Argument::type('string'), Argument::any())->will(function ($args, $event) {
         $action_form = $args[1]->getActionForm();
         $target = null;
         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
             $target =& $_GET;
         } else {
             $target = $_POST;
         }
         foreach ($target as $key => $value) {
             $action_form->set($key, $value);
         }
     });
     $this->backend->getController()->willReturn($this->controller);
     $this->controller->getBackend()->willReturn($this->backend);
     $this->controller->getActionError()->willReturn($this->action_error);
     $this->controller->getI18N()->willReturn($this->i18n);
     $this->controller->getLogger()->willReturn($this->logger);
     $this->controller->getPlugin()->willReturn($this->plugin);
 }
Example #2
0
 /**
  *  Ethna_ActionClassのコンストラクタ
  *
  *  @access public
  *  @param  object  Ethna_Backend   $backend    backendオブジェクト
  */
 public function __construct($backend)
 {
     $c = $backend->getController();
     $this->backend = $backend;
     $this->config = $this->backend->getConfig();
     $this->i18n = $this->backend->getI18N();
     $this->action_error = $this->backend->getActionError();
     $this->ae = $this->action_error;
     $this->action_form = $this->backend->getActionForm();
     $this->af = $this->action_form;
     $this->session = $this->backend->getSession();
     $this->plugin = $this->backend->getPlugin();
     $this->logger = $this->backend->getLogger();
     $this->preloadPlugin();
 }
Example #3
0
 public function setup()
 {
     parent::setup();
     $this->controller = $this->prophesize("Ethna_Controller");
     $this->backend = $this->prophesize("Ethna_Backend");
     $this->config = $this->prophesize("Ethna_Config");
     $this->i18n = $this->prophesize("Ethna_I18N");
     $this->action_error = $this->prophesize("Ethna_ActionError");
     $this->action_form = $this->prophesize("Ethna_ActionForm");
     $this->session = $this->prophesize("Ethna_Session");
     $this->plugin = $this->prophesize("Ethna_Plugin");
     $this->logger = $this->prophesize("Ethna_Logger");
     $this->backend->getLogger()->willReturn($this->logger);
     $this->backend->getPlugin()->willReturn($this->plugin);
     $this->backend->getSession()->willReturn($this->session);
     $this->backend->getActionForm()->willReturn($this->action_form);
     $this->backend->getActionError()->willReturn($this->action_error);
     $this->backend->getI18N()->willReturn($this->i18n);
     $this->backend->getConfig()->willReturn($this->config);
     $this->backend->getController()->willReturn($this->controller);
     $this->controller->getBackend()->willReturn($this->backend);
 }
Example #4
0
 /**
  *  レンダラオブジェクトを取得する
  *
  *  @access protected
  *  @return object  Ethna_Renderer  レンダラオブジェクト
  */
 public function _getRenderer()
 {
     $c = $this->backend->getController();
     $renderer = $c->getRenderer();
     $form_array = $this->af->getArray();
     $app_array = $this->af->getAppArray();
     $app_ne_array = $this->af->getAppNEArray();
     $renderer->setPropByRef('form', $form_array);
     $renderer->setPropByRef('app', $app_array);
     $renderer->setPropByRef('app_ne', $app_ne_array);
     $message_list = Ethna_Util::escapeHtml($this->ae->getMessageList());
     $renderer->setPropByRef('errors', $message_list);
     if (isset($_SESSION)) {
         $tmp_session = Ethna_Util::escapeHtml($_SESSION);
         $renderer->setPropByRef('session', $tmp_session);
     }
     $renderer->setProp('script', htmlspecialchars(basename($_SERVER['SCRIPT_NAME']), ENT_QUOTES, $this->ctl->getClientEncoding()));
     $renderer->setProp('request_uri', isset($_SERVER['REQUEST_URI']) ? htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, $this->ctl->getClientEncoding()) : '');
     $renderer->setProp('config', $this->config->get());
     return $renderer;
 }
Example #5
0
 /**
  *  アプリケーションオブジェクト(helper)を生成する
  *
  *  @access protected
  */
 public function _getHelperAppObject($key)
 {
     $app_object = $this->backend->getObject($key);
     return $app_object;
 }