Skip to content

Commit 851d1bc

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-65287
2 parents 234ca8d + 24f950d commit 851d1bc

File tree

10 files changed

+47
-20
lines changed

10 files changed

+47
-20
lines changed

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function sendPurgeRequest($tagsPattern)
6767
'1.1',
6868
$headers
6969
);
70+
$socketAdapter->read();
7071
$socketAdapter->close();
7172
} catch (\Exception $e) {
7273
$this->logger->critical($e->getMessage(), compact('server', 'tagsPattern'));

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public function testSendPurgeRequest($hosts)
7171
$this->socketAdapterMock->expects($this->at($i++))
7272
->method('write')
7373
->with('PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags', 'Host' => $uri->getHost()]);
74+
$this->socketAdapterMock->expects($this->at($i++))
75+
->method('read');
7476
$i++;
7577
}
7678
$this->socketAdapterMock->expects($this->exactly(count($uris)))

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
<argument name="at_call" xsi:type="string">getShortDescription</argument>
9595
<argument name="at_code" xsi:type="string">short_description</argument>
9696
<argument name="css_class" xsi:type="string">overview</argument>
97-
<argument name="at_label" translate="true" xsi:type="string">none</argument>
97+
<argument name="at_label" xsi:type="string">none</argument>
9898
<argument name="title" translate="true" xsi:type="string">Overview</argument>
9999
<argument name="add_attribute" xsi:type="string">itemprop="description"</argument>
100100
</arguments>

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Price.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,15 @@ public function getFinalPrice($qty, $product)
3939
*/
4040
public function getPrice($product)
4141
{
42-
if ($product->getCustomOption('simple_product')) {
43-
return $product->getCustomOption('simple_product')->getProduct()->getPrice();
44-
} else {
45-
return 0;
42+
if (!empty($product)) {
43+
$simpleProductOption = $product->getCustomOption('simple_product');
44+
if (!empty($simpleProductOption)) {
45+
$simpleProduct = $simpleProductOption->getProduct();
46+
if (!empty($simpleProduct)) {
47+
return $simpleProduct->getPrice();
48+
}
49+
}
4650
}
51+
return 0;
4752
}
4853
}

app/code/Magento/Quote/Model/ResourceModel/Quote.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,17 @@ public function substractProductFromQuotes($product)
242242
}
243243
$connection = $this->getConnection();
244244
$subSelect = $connection->select();
245+
$conditionCheck = $connection->quoteIdentifier('q.items_count') . " > 0";
246+
$conditionTrue = $connection->quoteIdentifier('q.items_count') . ' - 1';
247+
$ifSql = "IF (" . $conditionCheck . "," . $conditionTrue . ", 0)";
245248

246249
$subSelect->from(
247250
false,
248251
[
249252
'items_qty' => new \Zend_Db_Expr(
250253
$connection->quoteIdentifier('q.items_qty') . ' - ' . $connection->quoteIdentifier('qi.qty')
251254
),
252-
'items_count' => new \Zend_Db_Expr($connection->quoteIdentifier('q.items_count') . ' - 1')
255+
'items_count' => new \Zend_Db_Expr($ifSql)
253256
]
254257
)->join(
255258
['qi' => $this->getTable('quote_item')],

app/code/Magento/Swagger/view/frontend/templates/swagger-ui/index.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
*
1010
* The original name of this file, as part of the swagger-ui package, was dist/index.html.
1111
*
12-
* Modified by Magento, Modifications Copyright © 2016 Magento.
12+
* Modified by Magento, Modifications Copyright © 2013-2017 Magento.
1313
*/
1414

1515
/** @var \Magento\Framework\View\Element\Template $block */
1616

17-
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/default/schema?services=all';
17+
$schemaUrl = rtrim($block->getBaseUrl(), '/') . '/rest/all/schema?services=all';
1818
?>
1919

2020
<div id='header'>

app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ protected function _addField($parameter)
163163
}
164164
}
165165

166+
$data['value'] = html_entity_decode($data['value']);
167+
166168
// prepare element dropdown values
167169
if ($values = $parameter->getValues()) {
168170
// dropdown options are specified in configuration

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest">
1010
<variation name="NavigateMenuTest9">
11-
<data name="menuItem" xsi:type="string">Products > Catalog</data>
12-
<data name="pageTitle" xsi:type="string">Catalog</data>
11+
<data name="menuItem" xsi:type="string">Catalog > Products</data>
12+
<data name="pageTitle" xsi:type="string">Products</data>
1313
<constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/>
1414
</variation>
1515
<variation name="NavigateMenuTest10">
16-
<data name="menuItem" xsi:type="string">Products > Categories</data>
16+
<data name="menuItem" xsi:type="string">Catalog > Categories</data>
1717
<data name="pageTitle" xsi:type="string">Default Category (ID: 2)</data>
1818
<constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/>
1919
</variation>

lib/internal/Magento/Framework/App/Bootstrap.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
namespace Magento\Framework\App;
88

9-
use Magento\Framework\App\Filesystem\DirectoryList;
109
use Magento\Framework\AppInterface;
10+
use Magento\Framework\App\Filesystem\DirectoryList;
1111
use Magento\Framework\Autoload\AutoloaderRegistry;
1212
use Magento\Framework\Autoload\Populator;
1313
use Magento\Framework\Component\ComponentRegistrar;
14+
use Magento\Framework\Config\File\ConfigFilePool;
1415
use Magento\Framework\Filesystem\DriverPool;
1516
use Magento\Framework\Profiler;
16-
use Magento\Framework\Config\File\ConfigFilePool;
1717

1818
/**
1919
* A bootstrap of Magento application
@@ -284,7 +284,14 @@ protected function assertMaintenance()
284284
$this->initObjectManager();
285285
/** @var \Magento\Framework\App\MaintenanceMode $maintenance */
286286
$this->maintenance = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);
287-
$isOn = $this->maintenance->isOn(isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '');
287+
288+
/** @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress $phpRemoteAddressEnvironment */
289+
$phpRemoteAddressEnvironment = $this->objectManager->get(
290+
\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class
291+
);
292+
$remoteAddress = $phpRemoteAddressEnvironment->getRemoteAddress();
293+
$isOn = $this->maintenance->isOn($remoteAddress ? $remoteAddress : '');
294+
288295
if ($isOn && !$isExpected) {
289296
$this->errorCode = self::ERR_MAINTENANCE;
290297
throw new \Exception('Unable to proceed: the maintenance mode is enabled. ');
@@ -332,7 +339,7 @@ private function getIsExpected($key, $default)
332339
{
333340
if (array_key_exists($key, $this->server)) {
334341
if (isset($this->server[$key])) {
335-
return (bool)(int)$this->server[$key];
342+
return (bool) (int) $this->server[$key];
336343
}
337344
return null;
338345
}

lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
namespace Magento\Framework\App\Test\Unit;
1010

11+
use Magento\Framework\App\Filesystem\DirectoryList;
1112
use \Magento\Framework\App\Bootstrap;
12-
use \Magento\Framework\App\State;
1313
use \Magento\Framework\App\MaintenanceMode;
14-
15-
use Magento\Framework\App\Filesystem\DirectoryList;
14+
use \Magento\Framework\App\State;
1615

1716
/**
1817
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,6 +63,11 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase
6463
*/
6564
protected $bootstrapMock;
6665

66+
/**
67+
* @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress | \PHPUnit_Framework_MockObject_MockObject
68+
*/
69+
protected $remoteAddress;
70+
6771
protected function setUp()
6872
{
6973
$this->objectManagerFactory = $this->getMock(
@@ -82,6 +86,7 @@ protected function setUp()
8286
false
8387
);
8488
$this->maintenanceMode = $this->getMock(\Magento\Framework\App\MaintenanceMode::class, ['isOn'], [], '', false);
89+
$this->remoteAddress = $this->getMock('Magento\Framework\HTTP\PhpEnvironment\RemoteAddress', [], [], '', false);
8590
$filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
8691

8792
$this->logger = $this->getMock(\Psr\Log\LoggerInterface::class);
@@ -91,6 +96,7 @@ protected function setUp()
9196
$mapObjectManager = [
9297
[\Magento\Framework\App\Filesystem\DirectoryList::class, $this->dirs],
9398
[\Magento\Framework\App\MaintenanceMode::class, $this->maintenanceMode],
99+
[\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class, $this->remoteAddress],
94100
[\Magento\Framework\Filesystem::class, $filesystem],
95101
[\Magento\Framework\App\DeploymentConfig::class, $this->deploymentConfig],
96102
['Psr\Log\LoggerInterface', $this->logger],
@@ -205,7 +211,7 @@ public function testIsDeveloperModeDataProvider()
205211
[State::MODE_DEVELOPER, State::MODE_PRODUCTION, true],
206212
[State::MODE_PRODUCTION, State::MODE_DEVELOPER, false],
207213
[null, State::MODE_DEVELOPER, true],
208-
[null, State::MODE_PRODUCTION, false]
214+
[null, State::MODE_PRODUCTION, false],
209215
];
210216
}
211217

@@ -260,6 +266,7 @@ public function testAssertMaintenance($isOn, $isExpected)
260266
{
261267
$bootstrap = self::createBootstrap([Bootstrap::PARAM_REQUIRE_MAINTENANCE => $isExpected]);
262268
$this->maintenanceMode->expects($this->once())->method('isOn')->willReturn($isOn);
269+
$this->remoteAddress->expects($this->once())->method('getRemoteAddress')->willReturn(false);
263270
$this->application->expects($this->never())->method('launch');
264271
$this->application->expects($this->once())->method('catchException')->willReturn(true);
265272
$bootstrap->run($this->application);
@@ -273,7 +280,7 @@ public function assertMaintenanceDataProvider()
273280
{
274281
return [
275282
[true, false],
276-
[false, true]
283+
[false, true],
277284
];
278285
}
279286

0 commit comments

Comments
 (0)