Skip to content

Commit 9cfaf5a

Browse files
author
Magento CICD
authored
merge magento/2.2-develop into magento-panda/PANDA-FIXES-2.2
2 parents a574b0a + 5e2a47f commit 9cfaf5a

File tree

8 files changed

+602
-21
lines changed

8 files changed

+602
-21
lines changed

app/code/Magento/Checkout/Helper/Data.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
2020
{
2121
const XML_PATH_GUEST_CHECKOUT = 'checkout/options/guest_checkout';
2222

23+
/**
24+
* @deprecated
25+
*/
2326
const XML_PATH_CUSTOMER_MUST_BE_LOGGED = 'checkout/options/customer_must_be_logged';
2427

2528
/**
@@ -393,6 +396,7 @@ public function isContextCheckout()
393396
*
394397
* @return boolean
395398
* @codeCoverageIgnore
399+
* @deprecated
396400
*/
397401
public function isCustomerMustBeLogged()
398402
{

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ public function getConfig()
259259
$output['selectedShippingMethod'] = $this->getSelectedShippingMethod();
260260
$output['storeCode'] = $this->getStoreCode();
261261
$output['isGuestCheckoutAllowed'] = $this->isGuestCheckoutAllowed();
262-
$output['isCustomerLoginRequired'] = $this->isCustomerLoginRequired();
263262
$output['registerUrl'] = $this->getRegisterUrl();
264263
$output['checkoutUrl'] = $this->getCheckoutUrl();
265264
$output['defaultSuccessPageUrl'] = $this->getDefaultSuccessPageUrl();
@@ -513,17 +512,6 @@ private function isCustomerLoggedIn()
513512
return (bool)$this->httpContext->getValue(CustomerContext::CONTEXT_AUTH);
514513
}
515514

516-
/**
517-
* Check if customer must be logged in to proceed with checkout
518-
*
519-
* @return bool
520-
* @codeCoverageIgnore
521-
*/
522-
private function isCustomerLoginRequired()
523-
{
524-
return $this->checkoutHelper->isCustomerMustBeLogged();
525-
}
526-
527515
/**
528516
* Return forgot password URL
529517
*

app/code/Magento/Checkout/view/frontend/web/js/view/authentication.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ define([
1818

1919
return Component.extend({
2020
isGuestCheckoutAllowed: checkoutConfig.isGuestCheckoutAllowed,
21-
isCustomerLoginRequired: checkoutConfig.isCustomerLoginRequired,
2221
registerUrl: checkoutConfig.registerUrl,
2322
forgotPasswordUrl: checkoutConfig.forgotPasswordUrl,
2423
autocomplete: checkoutConfig.autocomplete,
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\App\Cache\Frontend;
8+
9+
use Magento\TestFramework\Helper\Bootstrap;
10+
11+
class FactoryTest extends \PHPUnit\Framework\TestCase
12+
{
13+
/**
14+
* Object Manager
15+
*
16+
* @var \Magento\Framework\ObjectManagerInterface
17+
*/
18+
private $objectManager;
19+
20+
/**
21+
* @var \Magento\Framework\App\Cache\Frontend\Factory
22+
*/
23+
private $factory;
24+
25+
/**
26+
* @var \Magento\Framework\App\Area
27+
*/
28+
private $model;
29+
30+
protected function setUp()
31+
{
32+
$this->objectManager = Bootstrap::getObjectManager();
33+
$this->factory = $this->objectManager->create(
34+
\Magento\Framework\App\Cache\Frontend\Factory::class
35+
);
36+
}
37+
38+
/**
39+
* Check RemoteSynchronizedCache
40+
* Removing any cache item in the RemoteSynchronizedCache must invalidate all cache items
41+
*
42+
* @magentoAppIsolation enabled
43+
* @magentoDbIsolation enabled
44+
*/
45+
public function testRemoteSynchronizedCache()
46+
{
47+
$data = 'data';
48+
$identifier = 'identifier';
49+
$secondIdentifier = 'secondIdentifier';
50+
$secondData = 'secondData';
51+
52+
$frontendOptions = ['backend' => 'remote_synchronized_cache'];
53+
$this->model = $this->factory->create($frontendOptions);
54+
55+
//Saving data
56+
$this->assertTrue($this->model->save($data, $identifier));
57+
$this->assertTrue($this->model->save($secondData, $secondIdentifier));
58+
59+
//Checking data
60+
$this->assertEquals($this->model->load($identifier), $data);
61+
$this->assertEquals($this->model->load($secondIdentifier), $secondData);
62+
63+
//Removing data
64+
sleep(2);
65+
$this->assertTrue($this->model->remove($secondIdentifier));
66+
$this->assertEquals($this->model->load($identifier), false);
67+
$this->assertEquals($this->model->load($secondIdentifier), false);
68+
69+
//Saving data
70+
$this->assertTrue($this->model->save($data, $identifier));
71+
$this->assertTrue($this->model->save($secondData, $secondIdentifier));
72+
73+
//Checking data
74+
$this->assertEquals($this->model->load($identifier), $data);
75+
$this->assertEquals($this->model->load($secondIdentifier), $secondData);
76+
77+
//Removing data
78+
sleep(2);
79+
$this->assertTrue($this->model->remove($identifier));
80+
$this->assertEquals($this->model->load($identifier), false);
81+
$this->assertEquals($this->model->load($secondIdentifier), false);
82+
}
83+
}

lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,15 @@ protected function _getBackendOptions(array $cacheOptions)
266266
$backendType = \Magento\Framework\Cache\Backend\Database::class;
267267
$options = $this->_getDbAdapterOptions();
268268
break;
269+
case 'remote_synchronized_cache':
270+
$backendType = \Magento\Framework\Cache\Backend\RemoteSynchronizedCache::class;
271+
$options['remote_backend'] = \Magento\Framework\Cache\Backend\Database::class;
272+
$options['remote_backend_options'] = $this->_getDbAdapterOptions();
273+
$options['local_backend'] = \Cm_Cache_Backend_File::class;
274+
$cacheDir = $this->_filesystem->getDirectoryWrite(DirectoryList::CACHE);
275+
$options['local_backend_options']['cache_dir'] = $cacheDir->getAbsolutePath();
276+
$cacheDir->create();
277+
break;
269278
default:
270279
if ($type != $this->_defaultBackend) {
271280
try {

lib/internal/Magento/Framework/Cache/Backend/Database.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,15 @@ public function save($data, $id, $tags = [], $specificLifetime = false)
216216
$time = time();
217217
$expire = $lifetime === 0 || $lifetime === null ? 0 : $time + $lifetime;
218218

219+
$idCol = $connection->quoteIdentifier('id');
219220
$dataCol = $connection->quoteIdentifier('data');
221+
$createCol = $connection->quoteIdentifier('create_time');
222+
$updateCol = $connection->quoteIdentifier('update_time');
220223
$expireCol = $connection->quoteIdentifier('expire_time');
221-
$query = "INSERT INTO {$dataTable} (\n {$connection->quoteIdentifier(
222-
'id'
223-
)},\n {$dataCol},\n {$connection->quoteIdentifier(
224-
'create_time'
225-
)},\n {$connection->quoteIdentifier(
226-
'update_time'
227-
)},\n {$expireCol})\n VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE\n
228-
{$dataCol}=VALUES({$dataCol}),\n {$expireCol}=VALUES({$expireCol})";
224+
225+
$query = "INSERT INTO {$dataTable} ({$idCol}, {$dataCol}, {$createCol}, {$updateCol}, {$expireCol}) " .
226+
"VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE {$dataCol}=VALUES({$dataCol}), " .
227+
"{$updateCol}=VALUES({$updateCol}), {$expireCol}=VALUES({$expireCol})";
229228

230229
$result = $connection->query($query, [$id, $data, $time, $time, $expire])->rowCount();
231230
}

0 commit comments

Comments
 (0)