Пример #1
0
 /**
  * @param CM_View_Abstract             $view
  * @param string                       $methodName
  * @param array|null                   $params
  * @param CM_Frontend_Environment|null $environment
  * @return CM_Http_Response_View_Ajax
  */
 public function getResponseAjax(CM_View_Abstract $view, $methodName, array $params = null, CM_Frontend_Environment $environment = null)
 {
     $request = $this->createRequestAjax($view, $methodName, $params);
     if ($environment) {
         $request->mockMethod('getViewer')->set(function () use($environment) {
             return $environment->getViewer();
         });
     }
     return $this->processRequest($request);
 }
Пример #2
0
 public function trackPageView(CM_Frontend_Environment $environment, $path)
 {
     if ($viewer = $environment->getViewer()) {
         $this->setUserId($viewer->getId());
     }
     if (CM_Http_Request_Abstract::hasInstance()) {
         $this->setRequestClientId(CM_Http_Request_Abstract::getInstance()->getClientId());
     }
 }
Пример #3
0
 public function trackPageView(CM_Frontend_Environment $environment, $path = null)
 {
     $this->setPageView($path);
     if ($viewer = $environment->getViewer()) {
         $this->setUserId($viewer->getId());
         $this->_flushTrackingQueue($viewer);
     }
 }
Пример #4
0
 public function trackPageView(CM_Frontend_Environment $environment, $path = null)
 {
     if ($viewer = $environment->getViewer()) {
         $this->setUserId($viewer->getId());
     }
     $this->setPageView($path);
 }
Пример #5
0
 public function trackPageView(CM_Frontend_Environment $environment, $path)
 {
     if ($viewer = $environment->getViewer()) {
         $this->_flushTrackingQueue($viewer);
     }
 }
Пример #6
0
 public function trackPageView(CM_Frontend_Environment $environment, $path)
 {
     if ($viewer = $environment->getViewer()) {
         $this->_setUser($viewer);
     }
 }
Пример #7
0
 /**
  * @param CM_View_Abstract             $view
  * @param string                       $methodName
  * @param array|null                   $params
  * @param CM_Frontend_Environment|null $environment
  * @return CM_Http_Response_View_Ajax
  */
 public function getResponseAjax(CM_View_Abstract $view, $methodName, array $params = null, CM_Frontend_Environment $environment = null)
 {
     $site = CM_Site_Abstract::factory();
     $request = $this->createRequestAjax($view, $methodName, $params, null, null, $site);
     if ($environment) {
         $request->mockMethod('getViewer')->set(function () use($environment) {
             return $environment->getViewer();
         });
     }
     $response = CM_Http_Response_View_Ajax::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     return $response;
 }
Пример #8
0
 /**
  * @expectedException CM_Exception_AuthRequired
  */
 public function testGetViewerNeeded()
 {
     $environment = new CM_Frontend_Environment();
     $environment->getViewer(true);
 }
Пример #9
0
 /**
  * @param CM_Frontend_Environment $environment
  */
 public function trackSignUp(CM_Frontend_Environment $environment)
 {
     if ($viewer = $environment->getViewer()) {
         $this->_pushEvent($viewer, 'signup', ['site' => $environment->getSite()->getHost()]);
     }
 }
Пример #10
0
 /**
  * @param CM_Frontend_Environment $environment
  * @throws CM_Exception_AuthRequired
  */
 protected function _checkViewer(CM_Frontend_Environment $environment)
 {
     $environment->getViewer(true);
 }