/**
  * Determine the admin path
  *
  * @return string
  */
 private function extractAdminPath()
 {
     $parsedUrl = parse_url($this->_storeManager->getStore()->getBaseUrl());
     $baseUrl = $parsedUrl['path'];
     $adminPath = $this->_frontNameResolver->getFrontName();
     return $baseUrl . $adminPath;
 }
 /**
  * @param $url
  * @param $host
  * @dataProvider hostsDataProvider
  */
 public function testIsHostBackend($url, $host, $expectedValue)
 {
     $backendUrl = $url;
     $_SERVER['HTTP_HOST'] = $host;
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE)->willReturn($backendUrl);
     $this->assertEquals($this->model->isHostBackend(), $expectedValue);
 }
Beispiel #3
0
 /**
  * Determine the admin path
  *
  * @param string $baseUrl
  * @return string
  * @throws \InvalidArgumentException
  */
 private function extractAdminPath($baseUrl)
 {
     if (!is_string($baseUrl)) {
         throw new \InvalidArgumentException('Cookie path is not a string.');
     }
     $adminPath = $this->frontNameResolver->getFrontName();
     if (!substr($baseUrl, -1) || '/' != substr($baseUrl, -1)) {
         $baseUrl = $baseUrl . '/';
     }
     return $baseUrl . $adminPath;
 }
 public function testIfCustomPathNotUsed()
 {
     $this->_configMock->expects(
         $this->once()
     )->method(
         'getValue'
     )->with(
         'admin/url/use_custom_path'
     )->will(
         $this->returnValue(false)
     );
     $this->assertEquals($this->_defaultFrontName, $this->_model->getFrontName());
 }
 /**
  * Determine the admin path
  *
  * @return string
  */
 private function extractAdminPath()
 {
     $backendApp = $this->backendAppList->getCurrentApp();
     $cookiePath = null;
     $baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
     if (!$backendApp) {
         $cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName();
         return $cookiePath;
     }
     //In case of application authenticating through the admin login, the script name should be removed
     //from the path, because application has own script.
     $baseUrl = \Magento\Framework\App\Request\Http::getUrlNoScript($baseUrl);
     $cookiePath = $baseUrl . $backendApp->getCookiePath();
     return $cookiePath;
 }
 public function isHostBackend()
 {
     if ($this->isDeveloper) {
         return "http://" . $_SERVER['HTTP_HOST'] . "/";
     }
     return parent::isHostBackend();
 }
 /**
  * @param string $url
  * @param string $host
  * @param string $useCustomAdminUrl
  * @param string $customAdminUrl
  * @param string $expectedValue
  * @dataProvider hostsDataProvider
  */
 public function testIsHostBackend($url, $host, $useCustomAdminUrl, $customAdminUrl, $expectedValue)
 {
     $_SERVER['HTTP_HOST'] = $host;
     $this->scopeConfigMock->expects($this->exactly(2))->method('getValue')->will($this->returnValueMap([[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url], [FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE, null, $useCustomAdminUrl], [FrontNameResolver::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE, null, $customAdminUrl]]));
     $this->assertEquals($this->model->isHostBackend(), $expectedValue);
 }
Beispiel #8
0
 /**
  * Return Backend area front name
  *
  * @return string
  */
 public function getAreaFrontName()
 {
     return $this->_frontNameResolver->getFrontName();
 }
Beispiel #9
0
 /**
  * Return Backend area front name
  *
  * @param bool $checkHost
  * @return bool|string
  */
 public function getAreaFrontName($checkHost = false)
 {
     return $this->_frontNameResolver->getFrontName($checkHost);
 }