Skip to content

Commit c0f3dfb

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #30405: 26133: Fixed - Coupon code text field not display in proper width in … (by @solwininfotech) - #30454: Remove incorrect use important in swatches option text (by @mrtuvn) - #30458: [Fixed-30452] - Design issue in minicart item remove confirmation modal (by @niravkrish) - #30355: Fix #30296 - Wrong ip value in sendfriend_log table (by @Bartlomiejsz) Fixed GitHub Issues: - #26133: Coupon code text field not display in proper width in Internet Explorer/EDGE browser (reported by @hasim32) has been fixed in #30405 by @solwininfotech in 2.4-develop branch Related commits: 1. a535faa 2. a37cf33 3. e8ad9ae - #30496: [Issue] Remove incorrect use important in swatches option text (reported by @m2-assistant[bot]) has been fixed in #30454 by @mrtuvn in 2.4-develop branch Related commits: 1. df5ae12 - #30452: Design issue in minicart item remove confirmation modal. (reported by @saumya1998) has been fixed in #30458 by @niravkrish in 2.4-develop branch Related commits: 1. daf0dc6 - #30296: Wrong ip value in send friend_log table (reported by @magento-engcom-team) has been fixed in #30355 by @Bartlomiejsz in 2.4-develop branch Related commits: 1. ccc83b2 2. bc53649
2 parents afd7ecc + 488506f commit c0f3dfb

File tree

7 files changed

+56
-49
lines changed

7 files changed

+56
-49
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
namespace Magento\SendFriend\Model\ResourceModel;
77

88
/**
9-
* SendFriend Log Resource Model
10-
*
11-
* @author Magento Core Team <[email protected]>
12-
*
139
* @api
1410
* @since 100.0.2
1511
*/
@@ -32,6 +28,7 @@ protected function _construct()
3228
* @param int $ip
3329
* @param int $startTime
3430
* @param int $websiteId
31+
*
3532
* @return int
3633
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3734
*/
@@ -46,7 +43,7 @@ public function getSendCount($object, $ip, $startTime, $websiteId = null)
4643
AND time>=:time
4744
AND website_id=:website_id'
4845
);
49-
$bind = ['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => (int)$websiteId];
46+
$bind = ['ip' => $ip, 'time' => $startTime, 'website_id' => (int)$websiteId];
5047

5148
$row = $connection->fetchRow($select, $bind);
5249
return $row['count'];
@@ -58,21 +55,24 @@ public function getSendCount($object, $ip, $startTime, $websiteId = null)
5855
* @param int $ip
5956
* @param int $startTime
6057
* @param int $websiteId
58+
*
6159
* @return $this
6260
*/
6361
public function addSendItem($ip, $startTime, $websiteId)
6462
{
6563
$this->getConnection()->insert(
6664
$this->getMainTable(),
67-
['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => $websiteId]
65+
['ip' => $ip, 'time' => $startTime, 'website_id' => $websiteId]
6866
);
67+
6968
return $this;
7069
}
7170

7271
/**
7372
* Delete Old logs
7473
*
7574
* @param int $time
75+
*
7676
* @return $this
7777
*/
7878
public function deleteLogsBefore($time)

app/design/frontend/Magento/blank/Magento_Swatches/web/css/source/_module.less

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
// _____________________________________________
6666

6767
& when (@media-common = true) {
68-
6968
.swatch {
7069
&-attribute {
7170
&-label {
@@ -155,7 +154,7 @@
155154
padding: 4px 8px;
156155

157156
&.selected {
158-
.lib-css(background-color, @swatch-option-text__selected__background-color) !important;
157+
.lib-css(background-color, @swatch-option-text__selected__background-color);
159158
}
160159
}
161160

@@ -201,21 +200,22 @@
201200
top: 0;
202201
}
203202
}
203+
204204
&-disabled {
205205
border: 0;
206206
cursor: default;
207207
outline: none !important;
208208

209209
&:after {
210210
.lib-rotate(-30deg);
211+
.lib-css(background, @swatch-option__disabled__background);
211212
content: '';
212213
height: 2px;
213214
left: -4px;
214215
position: absolute;
215216
top: 10px;
216217
width: 42px;
217218
z-index: 995;
218-
.lib-css(background, @swatch-option__disabled__background);
219219
}
220220
}
221221

@@ -226,6 +226,7 @@
226226
&-tooltip {
227227
.lib-css(border, @swatch-option-tooltip__border);
228228
.lib-css(color, @swatch-option-tooltip__color);
229+
.lib-css(background, @swatch-option-tooltip__background);
229230
display: none;
230231
max-height: 100%;
231232
min-height: 20px;
@@ -234,7 +235,6 @@
234235
position: absolute;
235236
text-align: center;
236237
z-index: 999;
237-
.lib-css(background, @swatch-option-tooltip__background);
238238

239239
&,
240240
&-layered {
@@ -278,9 +278,9 @@
278278
}
279279

280280
&-layered {
281+
.lib-css(background, @swatch-option-tooltip-layered__background);
281282
.lib-css(border, @swatch-option-tooltip-layered__border);
282283
.lib-css(color, @swatch-option-tooltip-layered__color);
283-
.lib-css(background, @swatch-option-tooltip-layered__background);
284284
display: none;
285285
left: -47px;
286286
position: absolute;
@@ -326,7 +326,6 @@
326326
margin: 2px 0;
327327
padding: 2px;
328328
position: static;
329-
z-index: 1;
330329
}
331330

332331
&-visual-tooltip-layered {

app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
.lib-icon-font-symbol(
268268
@_icon-font-content: @icon-trash
269269
);
270-
270+
271271
&:hover {
272272
.lib-css(text-decoration, @link__text-decoration);
273273
}
@@ -574,7 +574,7 @@
574574

575575
.widget {
576576
float: left;
577-
577+
578578
&.block {
579579
margin-bottom: @indent__base;
580580
}
@@ -727,9 +727,14 @@
727727
position: static;
728728
}
729729
}
730+
730731
&.discount {
731732
width: auto;
732733
}
734+
735+
.actions-toolbar {
736+
width: auto;
737+
}
733738
}
734739
}
735740

dev/tests/integration/testsuite/Magento/SendFriend/Model/SendFriendTest.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\SendFriend\Helper\Data as SendFriendHelper;
1414
use Magento\TestFramework\Helper\Bootstrap;
1515
use PHPUnit\Framework\TestCase;
16-
use Zend\Stdlib\Parameters;
16+
use Laminas\Stdlib\Parameters;
1717

1818
/**
1919
* Class checks send friend model behavior
@@ -28,6 +28,9 @@ class SendFriendTest extends TestCase
2828
/** @var SendFriend */
2929
private $sendFriend;
3030

31+
/** @var ResourceModel\SendFriend */
32+
private $sendFriendResource;
33+
3134
/** @var CookieManagerInterface */
3235
private $cookieManager;
3336

@@ -43,6 +46,7 @@ protected function setUp(): void
4346

4447
$this->objectManager = Bootstrap::getObjectManager();
4548
$this->sendFriend = $this->objectManager->get(SendFriendFactory::class)->create();
49+
$this->sendFriendResource = $this->objectManager->get(ResourceModel\SendFriend::class);
4650
$this->cookieManager = $this->objectManager->get(CookieManagerInterface::class);
4751
$this->request = $this->objectManager->get(RequestInterface::class);
4852
}
@@ -55,6 +59,7 @@ protected function setUp(): void
5559
* @param array $sender
5660
* @param array $recipients
5761
* @param string|bool $expectedResult
62+
*
5863
* @return void
5964
*/
6065
public function testValidate(array $sender, array $recipients, $expectedResult): void
@@ -185,22 +190,34 @@ public function testisExceedLimitByCookies(): void
185190
* @magentoDataFixture Magento/SendFriend/_files/sendfriend_log_record_half_hour_before.php
186191
*
187192
* @magentoDbIsolation disabled
193+
*
188194
* @return void
189195
*/
190196
public function testisExceedLimitByIp(): void
191197
{
192-
$this->markTestSkipped('Blocked by MC-31968');
198+
$remoteAddr = '127.0.0.1';
193199
$parameters = $this->objectManager->create(Parameters::class);
194-
$parameters->set('REMOTE_ADDR', '127.0.0.1');
200+
$parameters->set('REMOTE_ADDR', $remoteAddr);
195201
$this->request->setServer($parameters);
196202
$this->assertTrue($this->sendFriend->isExceedLimit());
203+
// Verify that ip is saved correctly as integer value
204+
$this->assertEquals(
205+
1,
206+
(int)$this->sendFriendResource->getSendCount(
207+
null,
208+
ip2long($remoteAddr),
209+
time() - (60 * 60 * 24 * 365),
210+
1
211+
)
212+
);
197213
}
198214

199215
/**
200-
* Check result
216+
* Check test result
201217
*
202218
* @param array|bool $expectedResult
203219
* @param array|bool $result
220+
*
204221
* @return void
205222
*/
206223
private function checkResult($expectedResult, $result): void
@@ -217,6 +234,7 @@ private function checkResult($expectedResult, $result): void
217234
*
218235
* @param array $sender
219236
* @param array $recipients
237+
*
220238
* @return void
221239
*/
222240
private function prepareData(array $sender, array $recipients): void

lib/internal/Magento/Framework/HTTP/PhpEnvironment/RemoteAddress.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function (string $ip) {
120120
public function getRemoteAddress(bool $ipToLong = false)
121121
{
122122
if ($this->remoteAddress !== null) {
123-
return $this->remoteAddress;
123+
return $ipToLong ? ip2long($this->remoteAddress) : $this->remoteAddress;
124124
}
125125

126126
$remoteAddress = $this->readAddress();
@@ -135,11 +135,11 @@ public function getRemoteAddress(bool $ipToLong = false)
135135
$this->remoteAddress = false;
136136

137137
return false;
138-
} else {
139-
$this->remoteAddress = $remoteAddress;
140-
141-
return $ipToLong ? ip2long($this->remoteAddress) : $this->remoteAddress;
142138
}
139+
140+
$this->remoteAddress = $remoteAddress;
141+
142+
return $ipToLong ? ip2long($this->remoteAddress) : $this->remoteAddress;
143143
}
144144

145145
/**

lib/internal/Magento/Framework/HTTP/Test/Unit/PhpEnvironment/RemoteAddressTest.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,28 @@
99

1010
use Magento\Framework\App\Request\Http as HttpRequest;
1111
use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
12-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1312
use PHPUnit\Framework\MockObject\MockObject;
1413
use PHPUnit\Framework\TestCase;
1514

1615
/**
17-
* Test for
18-
*
1916
* @see RemoteAddress
2017
*/
2118
class RemoteAddressTest extends TestCase
2219
{
2320
/**
2421
* @var MockObject|HttpRequest
2522
*/
26-
protected $_request;
27-
28-
/**
29-
* @var ObjectManager
30-
*/
31-
protected $_objectManager;
23+
private $requestMock;
3224

3325
/**
3426
* @inheritdoc
3527
*/
3628
protected function setUp(): void
3729
{
38-
$this->_request = $this->getMockBuilder(HttpRequest::class)
30+
$this->requestMock = $this->getMockBuilder(HttpRequest::class)
3931
->disableOriginalConstructor()
40-
->setMethods(['getServer'])
32+
->onlyMethods(['getServer'])
4133
->getMock();
42-
43-
$this->_objectManager = new ObjectManager($this);
4434
}
4535

4636
/**
@@ -49,6 +39,7 @@ protected function setUp(): void
4939
* @param string|bool $expected
5040
* @param bool $ipToLong
5141
* @param string[]|null $trustedProxies
42+
*
5243
* @return void
5344
* @dataProvider getRemoteAddressProvider
5445
*/
@@ -59,18 +50,16 @@ public function testGetRemoteAddress(
5950
bool $ipToLong,
6051
array $trustedProxies = null
6152
): void {
62-
$remoteAddress = $this->_objectManager->getObject(
63-
RemoteAddress::class,
64-
[
65-
'httpRequest' => $this->_request,
66-
'alternativeHeaders' => $alternativeHeaders,
67-
'trustedProxies' => $trustedProxies,
68-
]
53+
$remoteAddress = new RemoteAddress(
54+
$this->requestMock,
55+
$alternativeHeaders,
56+
$trustedProxies
6957
);
70-
$this->_request->expects($this->any())
71-
->method('getServer')
58+
$this->requestMock->method('getServer')
7259
->willReturnMap($serverValueMap);
7360

61+
// Check twice to verify if internal variable is cached correctly
62+
$this->assertEquals($expected, $remoteAddress->getRemoteAddress($ipToLong));
7463
$this->assertEquals($expected, $remoteAddress->getRemoteAddress($ipToLong));
7564
}
7665

lib/web/css/source/components/_modals.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@
103103
&.confirm {
104104
.modal-inner-wrap {
105105
.lib-css(max-width, @modal-popup-confirm__width);
106-
107-
.modal-content {
108-
padding-right: 7rem;
109-
}
110106
}
111107
}
112108

0 commit comments

Comments
 (0)