Skip to content

Commit b11a447

Browse files
author
Dale Sikkema
committed
MAGETWO-33609: pull request for stories in this sprint
1 parent f7da58c commit b11a447

File tree

11 files changed

+40
-50
lines changed

11 files changed

+40
-50
lines changed

app/code/Magento/Backend/App/Router.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ class Router extends \Magento\Framework\App\Router\Base
5353
* @param \Magento\Framework\App\ResponseFactory $responseFactory
5454
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
5555
* @param \Magento\Framework\UrlInterface $url
56-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
5756
* @param string $routerId
5857
* @param \Magento\Framework\Code\NameBuilder $nameBuilder
59-
* @param \Magento\Framework\App\Router\SecureUrlInterface $secureUrl
58+
* @param \Magento\Framework\App\Router\PathConfigInterface $pathConfig
6059
* @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
6160
* @param \Magento\Backend\App\ConfigInterface $backendConfig
6261
*
@@ -69,10 +68,9 @@ public function __construct(
6968
\Magento\Framework\App\ResponseFactory $responseFactory,
7069
\Magento\Framework\App\Route\ConfigInterface $routeConfig,
7170
\Magento\Framework\UrlInterface $url,
72-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
7371
$routerId,
7472
\Magento\Framework\Code\NameBuilder $nameBuilder,
75-
\Magento\Framework\App\Router\SecureUrlInterface $secureUrl,
73+
\Magento\Framework\App\Router\PathConfigInterface $pathConfig,
7674
\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig,
7775
\Magento\Backend\App\ConfigInterface $backendConfig
7876
) {
@@ -83,10 +81,9 @@ public function __construct(
8381
$responseFactory,
8482
$routeConfig,
8583
$url,
86-
$scopeConfig,
8784
$routerId,
8885
$nameBuilder,
89-
$secureUrl
86+
$pathConfig
9087
);
9188
$this->_coreConfig = $coreConfig;
9289
$this->_backendConfig = $backendConfig;

app/code/Magento/Backend/Model/Config/Backend/Baseurl.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\Backend\Model\Config\Backend;
77

8-
use Magento\Store\Model\StoreManagerInterface;
9-
108
class Baseurl extends \Magento\Framework\App\Config\Value
119
{
1210
/**

app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ class Standard extends \Magento\Framework\App\Router\Base
4747
* @param \Magento\Framework\App\ResponseFactory $responseFactory
4848
* @param \Magento\Framework\App\Route\Config $routeConfig
4949
* @param \Magento\Framework\UrlInterface $url
50-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
5150
* @param string $routerId
5251
* @param \Magento\Framework\Code\NameBuilder $nameBuilder
53-
* @param \Magento\Framework\App\Router\SecureUrlInterface $secureUrl
52+
* @param \Magento\Framework\App\Router\PathConfigInterface $pathConfig
5453
* @param \Magento\Framework\App\RouterListInterface $routerList
5554
* @param \Magento\DesignEditor\Helper\Data $designEditorHelper
5655
* @param \Magento\DesignEditor\Model\State $designEditorState
@@ -65,10 +64,9 @@ public function __construct(
6564
\Magento\Framework\App\ResponseFactory $responseFactory,
6665
\Magento\Framework\App\Route\Config $routeConfig,
6766
\Magento\Framework\UrlInterface $url,
68-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
6967
$routerId,
7068
\Magento\Framework\Code\NameBuilder $nameBuilder,
71-
\Magento\Framework\App\Router\SecureUrlInterface $secureUrl,
69+
\Magento\Framework\App\Router\PathConfigInterface $pathConfig,
7270
\Magento\Framework\App\RouterListInterface $routerList,
7371
\Magento\DesignEditor\Helper\Data $designEditorHelper,
7472
\Magento\DesignEditor\Model\State $designEditorState,
@@ -81,10 +79,9 @@ public function __construct(
8179
$responseFactory,
8280
$routeConfig,
8381
$url,
84-
$scopeConfig,
8582
$routerId,
8683
$nameBuilder,
87-
$secureUrl
84+
$pathConfig
8885
);
8986
$this->_routerList = $routerList;
9087
$this->_designEditorHelper = $designEditorHelper;

app/code/Magento/Store/Model/SecureUrl.php renamed to app/code/Magento/Store/Model/PathConfig.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
*/
66
namespace Magento\Store\Model;
77

8-
use Magento\Store\Model\StoreManagerInterface;
9-
use Magento\Store\Model\ScopeInterface;
10-
use Magento\Store\Model\Store;
11-
12-
class SecureUrl implements \Magento\Framework\App\Router\SecureUrlInterface
8+
class PathConfig implements \Magento\Framework\App\Router\PathConfigInterface
139
{
1410
/** @var \Magento\Framework\App\Config\ScopeConfigInterface */
1511
private $scopeConfig;
@@ -72,4 +68,14 @@ public function shouldBeSecure($path)
7268
PHP_URL_SCHEME
7369
) == 'https' && $this->urlSecurityInfo->isSecure($path);
7470
}
71+
72+
/**
73+
* {@inheritdoc}
74+
*
75+
* @return string
76+
*/
77+
public function getDefaultPath()
78+
{
79+
return $this->scopeConfig->getValue('web/default/front', ScopeInterface::SCOPE_STORE);
80+
}
7581
}

app/code/Magento/Store/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</type>
5757
<preference for="Magento\Framework\App\Config\Scope\ReaderPoolInterface" type="Magento\Store\Model\Config\Reader\ReaderPool"/>
5858
<preference for="Magento\Framework\App\ScopeResolverInterface" type="Magento\Store\Model\Resolver\Store" />
59-
<preference for="Magento\Framework\App\Router\SecureUrlInterface" type="Magento\Store\Model\SecureUrl" />
59+
<preference for="Magento\Framework\App\Router\PathConfigInterface" type="Magento\Store\Model\PathConfig" />
6060
<type name="Magento\Framework\App\Action\Action">
6161
<plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck" sortOrder="10"/>
6262
<plugin name="designLoader" type="Magento\Framework\App\Action\Plugin\Design" sortOrder="30"/>

app/code/Magento/Translation/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"require": {
55
"php": "~5.5.0|~5.6.0",
66
"magento/module-backend": "0.42.0-beta8",
7-
"magento/module-core": "0.42.0-beta8",
87
"magento/module-developer": "0.42.0-beta8",
98
"magento/module-store": "0.42.0-beta8",
109
"magento/module-theme": "0.42.0-beta8",

app/code/Magento/Version/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"magento/magento-composer-installer": "*"
88
},
99
"type": "magento2-module",
10-
"version": "0.42.0-beta7",
10+
"version": "0.42.0-beta8",
1111
"license": [
1212
"OSL-3.0",
1313
"AFL-3.0"

dev/tests/unit/testsuite/Magento/Store/Model/SecureUrlTest.php renamed to dev/tests/unit/testsuite/Magento/Store/Model/PathConfigTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Store\Model\Store;
1414
use Magento\TestFramework\Helper\ObjectManager;
1515

16-
class SecureUrlTest extends \PHPUnit_Framework_TestCase
16+
class PathConfigTest extends \PHPUnit_Framework_TestCase
1717
{
1818
/** @var \Magento\Framework\App\Config\ScopeConfigInterface | \PHPUnit_Framework_MockObject_MockObject*/
1919
private $scopeConfigMock;
@@ -23,7 +23,7 @@ class SecureUrlTest extends \PHPUnit_Framework_TestCase
2323
private $storeManagerMock;
2424
/** @var Store | \PHPUnit_Framework_MockObject_MockObject*/
2525
private $storeMock;
26-
/** @var \Magento\Store\Model\SecureUrl */
26+
/** @var \Magento\Store\Model\RouteConfig */
2727
protected $model;
2828

2929
public function setUp()
@@ -45,7 +45,7 @@ public function setUp()
4545
'urlSecurityInfo' => $this->urlSecurityInfoMock,
4646
'storeManager' => $this->storeManagerMock,
4747
];
48-
$this->model = (new ObjectManager($this))->getObject('\Magento\Store\Model\SecureUrl', $mockArgs);
48+
$this->model = (new ObjectManager($this))->getObject('\Magento\Store\Model\PathConfig', $mockArgs);
4949
}
5050

5151
public function testGetCurrentSecureUrlNoAlias()

dev/tests/unit/testsuite/Magento/Wishlist/Controller/Index/AllcartTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AllcartTest extends \PHPUnit_Framework_TestCase
1919
protected $itemCarrier;
2020

2121
/**
22-
* @var \Magento\Core\App\Action\FormKeyValidator|\PHPUnit_Framework_MockObject_MockObject
22+
* @var \Magento\Framework\Data\Form\FormKey\Validator|\PHPUnit_Framework_MockObject_MockObject
2323
*/
2424
protected $formKeyValidator;
2525

@@ -43,7 +43,7 @@ protected function setUp()
4343
$this->context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false);
4444
$this->wishlistProvider = $this->getMock('Magento\Wishlist\Controller\WishlistProvider', [], [], '', false);
4545
$this->itemCarrier = $this->getMock('Magento\Wishlist\Model\ItemCarrier', [], [], '', false);
46-
$this->formKeyValidator = $this->getMock('Magento\Core\App\Action\FormKeyValidator', [], [], '', false);
46+
$this->formKeyValidator = $this->getMock('Magento\Framework\Data\Form\FormKey\Validator', [], [], '', false);
4747
$this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false);
4848
$this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false);
4949
}

lib/internal/Magento/Framework/App/Router/Base.php

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
use Magento\Framework\App\RequestInterface;
1111
use Magento\Store\Model\ScopeInterface;
12-
use Magento\Store\Model\StoreManagerInterface;
1312

1413
/**
1514
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -110,8 +109,8 @@ class Base implements \Magento\Framework\App\RouterInterface
110109
*/
111110
protected $actionList;
112111

113-
/** @var SecureUrlInterface */
114-
private $secureUrl;
112+
/** @var PathConfigInterface */
113+
protected $pathConfig;
115114

116115
/**
117116
* @param \Magento\Framework\App\Router\ActionList $actionList
@@ -120,10 +119,9 @@ class Base implements \Magento\Framework\App\RouterInterface
120119
* @param \Magento\Framework\App\ResponseFactory $responseFactory
121120
* @param \Magento\Framework\App\Route\ConfigInterface $routeConfig
122121
* @param \Magento\Framework\UrlInterface $url
123-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
124122
* @param string $routerId
125123
* @param \Magento\Framework\Code\NameBuilder $nameBuilder
126-
* @param \Magento\Framework\App\Router\SecureUrlInterface $secureUrl
124+
* @param \Magento\Framework\App\Router\PathConfigInterface $pathConfig
127125
*
128126
* @throws \InvalidArgumentException
129127
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -136,20 +134,18 @@ public function __construct(
136134
\Magento\Framework\App\ResponseFactory $responseFactory,
137135
\Magento\Framework\App\Route\ConfigInterface $routeConfig,
138136
\Magento\Framework\UrlInterface $url,
139-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
140137
$routerId,
141138
\Magento\Framework\Code\NameBuilder $nameBuilder,
142-
\Magento\Framework\App\Router\SecureUrlInterface $secureUrl
139+
\Magento\Framework\App\Router\PathConfigInterface $pathConfig
143140
) {
144141
$this->actionList = $actionList;
145142
$this->actionFactory = $actionFactory;
146143
$this->_responseFactory = $responseFactory;
147144
$this->_defaultPath = $defaultPath;
148145
$this->_routeConfig = $routeConfig;
149-
$this->_scopeConfig = $scopeConfig;
150146
$this->_url = $url;
151147
$this->nameBuilder = $nameBuilder;
152-
$this->secureUrl = $secureUrl;
148+
$this->pathConfig = $pathConfig;
153149
}
154150

155151
/**
@@ -177,7 +173,7 @@ protected function parseRequest(\Magento\Framework\App\RequestInterface $request
177173

178174
$path = trim($request->getPathInfo(), '/');
179175

180-
$params = explode('/', $path ? $path : $this->_getDefaultPath());
176+
$params = explode('/', $path ? $path : $this->pathConfig->getDefaultPath());
181177
foreach ($this->_requiredParams as $paramName) {
182178
$output[$paramName] = array_shift($params);
183179
}
@@ -326,16 +322,6 @@ protected function matchAction(\Magento\Framework\App\RequestInterface $request,
326322
return $actionInstance;
327323
}
328324

329-
/**
330-
* Get router default request path
331-
*
332-
* @return string
333-
*/
334-
protected function _getDefaultPath()
335-
{
336-
return $this->_scopeConfig->getValue('web/default/front', ScopeInterface::SCOPE_STORE);
337-
}
338-
339325
/**
340326
* Build controller class name
341327
*
@@ -364,8 +350,8 @@ protected function _checkShouldBeSecure(\Magento\Framework\App\RequestInterface
364350
return;
365351
}
366352

367-
if ($this->secureUrl->shouldBeSecure($path) && !$request->isSecure()) {
368-
$url = $this->secureUrl->getCurrentSecureUrl($request);
353+
if ($this->pathConfig->shouldBeSecure($path) && !$request->isSecure()) {
354+
$url = $this->pathConfig->getCurrentSecureUrl($request);
369355
if ($this->_shouldRedirectToSecure()) {
370356
$url = $this->_url->getRedirectUrl($url);
371357
}

0 commit comments

Comments
 (0)