-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #25706: [Tax] Cover Tax CustomerData by Unit Test (by @edenduong) - #25717: add the id of the category to the category tree names (by @brosenberger) - #25719: ASI #Issue-723 Fixed the issue: "Image preview should be closed when the page is changed" (by @serhiyzhovnir) - #25686: Unit Test to cover class \Magento\Captcha\CustomerData\Captcha (by @edenduong) - #25702: [ImportExport] Cover Helper Data by Unit Test (by @edenduong) - #25313: feature/25312 Add Colombian regions (by @magudelo62) - #25172: Add validation in catalog rule and shopping cart rule form (by @edenduong) - #25566: The image details are not hidden when click on same image (by @engcom-Golf) Fixed GitHub Issues: - #723: Magento JMeter Performance Testing best practices (reported by @pmouawad) has been fixed in #25719 by @serhiyzhovnir in 2.3-develop branch Related commits: 1. f307e2e - #25312: Add Colombian regions (reported by @magudelo62) has been fixed in #25313 by @magudelo62 in 2.3-develop branch Related commits: 1. a9f499e - #690: Media image attribute in product listing (reported by @tzyganu) has been fixed in #25566 by @engcom-Golf in 2.3-develop branch Related commits: 1. f070206 2. c23393d 3. aa7195a 4. e29914e 5. a565ee0 6. b30b855 7. a7ffbd6 8. e5d143d
- Loading branch information
Showing
17 changed files
with
686 additions
and
3 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
app/code/Magento/Captcha/Test/Unit/CustomerData/CaptchaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Captcha\Test\Unit\CustomerData; | ||
|
||
use Magento\Captcha\Helper\Data as CaptchaHelper; | ||
use Magento\Customer\Model\Session as CustomerSession; | ||
use Magento\Captcha\CustomerData\Captcha; | ||
use Magento\Captcha\Model\DefaultModel; | ||
use Magento\Customer\Api\Data\CustomerInterface as CustomerData; | ||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class CaptchaTest extends TestCase | ||
{ | ||
/** | ||
* @var CaptchaHelper|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $helperMock; | ||
|
||
/** | ||
* @var CustomerSession|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $customerSessionMock; | ||
|
||
/** | ||
* @var Captcha | ||
*/ | ||
private $model; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $formIds; | ||
|
||
/** | ||
* @var ObjectManagerHelper | ||
*/ | ||
protected $objectManagerHelper; | ||
|
||
/** | ||
* Create mocks and model | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->helperMock = $this->createMock(CaptchaHelper::class); | ||
$this->customerSessionMock = $this->createMock(CustomerSession::class); | ||
$this->formIds = [ | ||
'user_login' | ||
]; | ||
$this->objectManagerHelper = new ObjectManagerHelper($this); | ||
$this->model = $this->objectManagerHelper->getObject( | ||
Captcha::class, | ||
[ | ||
'helper' => $this->helperMock, | ||
'formIds' => $this->formIds, | ||
'customerSession' => $this->customerSessionMock | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Test getSectionData() when user is login and require captcha | ||
*/ | ||
public function testGetSectionDataWhenLoginAndRequireCaptcha() | ||
{ | ||
$emailLogin = 'test@localhost.com'; | ||
|
||
$userLoginModel = $this->createMock(DefaultModel::class); | ||
$userLoginModel->expects($this->any())->method('isRequired')->with($emailLogin) | ||
->willReturn(true); | ||
$this->helperMock->expects($this->any())->method('getCaptcha')->with('user_login')->willReturn($userLoginModel); | ||
|
||
$this->customerSessionMock->expects($this->any())->method('isLoggedIn') | ||
->willReturn(true); | ||
|
||
$customerDataMock = $this->createMock(CustomerData::class); | ||
$customerDataMock->expects($this->any())->method('getEmail')->willReturn($emailLogin); | ||
$this->customerSessionMock->expects($this->any())->method('getCustomerData') | ||
->willReturn($customerDataMock); | ||
|
||
/* Assert to test */ | ||
$this->assertEquals( | ||
[ | ||
"user_login" => [ | ||
"isRequired" => true, | ||
"timestamp" => time() | ||
] | ||
], | ||
$this->model->getSectionData() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
app/code/Magento/Directory/Setup/Patch/Data/AddDataForColombia.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\Directory\Setup\Patch\Data; | ||
|
||
use Magento\Directory\Setup\DataInstaller; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
|
||
/** | ||
* Class AddDataForColombia | ||
*/ | ||
class AddDataForColombia implements DataPatchInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* @var \Magento\Directory\Setup\DataInstallerFactory | ||
*/ | ||
private $dataInstallerFactory; | ||
|
||
/** | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
* @param \Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory | ||
*/ | ||
public function __construct( | ||
ModuleDataSetupInterface $moduleDataSetup, | ||
\Magento\Directory\Setup\DataInstallerFactory $dataInstallerFactory | ||
) { | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->dataInstallerFactory = $dataInstallerFactory; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
/** @var DataInstaller $dataInstaller */ | ||
$dataInstaller = $this->dataInstallerFactory->create(); | ||
$dataInstaller->addCountryRegions( | ||
$this->moduleDataSetup->getConnection(), | ||
$this->getDataForColombia() | ||
); | ||
} | ||
|
||
/** | ||
* Colombia states data. | ||
* | ||
* @return array | ||
*/ | ||
private function getDataForColombia() | ||
{ | ||
return [ | ||
['CO', 'CO-AMA', 'Amazonas'], | ||
['CO', 'CO-ANT', 'Antioquia'], | ||
['CO', 'CO-ARA', 'Arauca'], | ||
['CO', 'CO-ATL', 'Atlántico'], | ||
['CO', 'CO-BOL', 'Bolívar'], | ||
['CO', 'CO-BOY', 'Boyacá'], | ||
['CO', 'CO-CAL', 'Caldas'], | ||
['CO', 'CO-CAQ', 'Caquetá'], | ||
['CO', 'CO-CAS', 'Casanare'], | ||
['CO', 'CO-CAU', 'Cauca'], | ||
['CO', 'CO-CES', 'Cesar'], | ||
['CO', 'CO-CHO', 'Chocó'], | ||
['CO', 'CO-COR', 'Córdoba'], | ||
['CO', 'CO-CUN', 'Cundinamarca'], | ||
['CO', 'CO-GUA', 'Guainía'], | ||
['CO', 'CO-GUV', 'Guaviare'], | ||
['CO', 'CO-HUL', 'Huila'], | ||
['CO', 'CO-LAG', 'La Guajira'], | ||
['CO', 'CO-MAG', 'Magdalena'], | ||
['CO', 'CO-MET', 'Meta'], | ||
['CO', 'CO-NAR', 'Nariño'], | ||
['CO', 'CO-NSA', 'Norte de Santander'], | ||
['CO', 'CO-PUT', 'Putumayo'], | ||
['CO', 'CO-QUI', 'Quindío'], | ||
['CO', 'CO-RIS', 'Risaralda'], | ||
['CO', 'CO-SAP', 'San Andrés y Providencia'], | ||
['CO', 'CO-SAN', 'Santander'], | ||
['CO', 'CO-SUC', 'Sucre'], | ||
['CO', 'CO-TOL', 'Tolima'], | ||
['CO', 'CO-VAC', 'Valle del Cauca'], | ||
['CO', 'CO-VAU', 'Vaupés'], | ||
['CO', 'CO-VID', 'Vichada'], | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return [ | ||
InitializeDirectoryData::class, | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.