Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op latest changes

Accepted Community Pull Requests:
 - #29693: improve test AccountTest (by @engcom-Charlie)
 - #29682: Revert "Add validation phone field on checkout page" (by @engcom-Charlie)


Fixed GitHub Issues:
 - #29700: [Issue] improve test AccountTest (reported by @m2-assistant[bot]) has been fixed in #29693 by @engcom-Charlie in 2.4-develop branch
   Related commits:
     1. af54db3
  • Loading branch information
magento-engcom-team authored Aug 21, 2020
2 parents 53bcc78 + ac83c58 commit 8b7d949
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 73 deletions.
3 changes: 0 additions & 3 deletions app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,6 @@ private function getBillingAddressComponent($paymentCode, $elements)
],
],
'telephone' => [
'validation' => [
'validate-phoneStrict' => 0,
],
'config' => [
'tooltip' => [
'description' => __('For delivery questions.'),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@
</item>
</item>
<item name="telephone" xsi:type="array">
<item name="validation" xsi:type="array">
<item name="validate-phoneStrict" xsi:type="number">0</item>
</item>
<item name="config" xsi:type="array">
<item name="tooltip" xsi:type="array">
<item name="description" xsi:type="string" translate="true">For delivery questions.</item>
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<item>Bld D</item>
</array>
<data key="company">Magento</data>
<data key="telephone">123-456-7890</data>
<data key="telephone">1234568910</data>
<data key="fax">1234568910</data>
<data key="postcode">78729</data>
<data key="city">Austin</data>
Expand Down Expand Up @@ -172,7 +172,7 @@
<data key="city">London</data>
<data key="postcode">SE1 7RW</data>
<data key="country_id">GB</data>
<data key="telephone">444-444-4444</data>
<data key="telephone">444-44-444-44</data>
</entity>
<entity name="US_Address_Utah" type="address">
<data key="firstname">John</data>
Expand Down Expand Up @@ -227,7 +227,7 @@
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="company">Magento</data>
<data key="telephone">888-777-7890</data>
<data key="telephone">0123456789-02134567</data>
<array key="street">
<item>172, Westminster Bridge Rd</item>
<item>7700 xyz street</item>
Expand Down Expand Up @@ -305,7 +305,7 @@
<data key="firstname">Jane</data>
<data key="lastname">Miller</data>
<data key="company">Magento</data>
<data key="telephone">123-456-7899</data>
<data key="telephone">44 20 7123 1234</data>
<array key="street">
<item>1 London Bridge Street</item>
</array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
use Magento\Store\Model\StoreManager;
use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\Helper\Xpath;
use Magento\TestFramework\Mail\Template\TransportBuilderMock;
use Magento\TestFramework\Request;
use Magento\TestFramework\TestCase\AbstractController;
use Magento\Theme\Controller\Result\MessagePlugin;
use PHPUnit\Framework\Constraint\StringContains;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class AccountTest extends \Magento\TestFramework\TestCase\AbstractController
class AccountTest extends AbstractController
{
/**
* @var TransportBuilderMock
Expand All @@ -54,9 +56,8 @@ protected function setUp(): void
*/
protected function login($customerId)
{
/** @var \Magento\Customer\Model\Session $session */
$session = Bootstrap::getObjectManager()
->get(\Magento\Customer\Model\Session::class);
/** @var Session $session */
$session = Bootstrap::getObjectManager()->get(Session::class);
$session->loginById($customerId);
}

Expand Down Expand Up @@ -148,8 +149,8 @@ public function testCreatepasswordActionWithSession()
$customer->setData('confirmation', 'confirmation');
$customer->save();

/** @var \Magento\Customer\Model\Session $customer */
$session = Bootstrap::getObjectManager()->get(\Magento\Customer\Model\Session::class);
/** @var Session $customer */
$session = Bootstrap::getObjectManager()->get(Session::class);
$session->setRpToken($token);
$session->setRpCustomerId($customer->getId());

Expand Down Expand Up @@ -404,18 +405,16 @@ public function testEditAction()
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode(), $body);
$this->assertStringContainsString('<div class="field field-name-firstname required">', $body);
// Verify the password check box is not checked
$expectedString = <<<EXPECTED_HTML
<input type="checkbox" name="change_password" id="change-password" data-role="change-password" value="1"
title="Change&#x20;Password"
class="checkbox" />
EXPECTED_HTML;
$this->assertStringContainsString($expectedString, $body);
$checkboxXpath = '//input[@type="checkbox"][@name="change_password"][@id="change-password"][not (@checked)]' .
'[@data-role="change-password"][@value="1"][@title="Change Password"][@class="checkbox"]';

$this->assertEquals(1, Xpath::getElementsCountForXpath($checkboxXpath, $body));
}

/**
* @magentoDataFixture Magento/Customer/_files/customer.php
*/
public function testChangePasswordEditAction()
public function testChangePasswordEditAction(): void
{
$this->login(1);

Expand All @@ -425,12 +424,11 @@ public function testChangePasswordEditAction()
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode(), $body);
$this->assertStringContainsString('<div class="field field-name-firstname required">', $body);
// Verify the password check box is checked
$expectedString = <<<EXPECTED_HTML
<input type="checkbox" name="change_password" id="change-password" data-role="change-password" value="1"
title="Change&#x20;Password"
checked="checked" class="checkbox" />
EXPECTED_HTML;
$this->assertStringContainsString($expectedString, $body);
$checkboxXpath = '//input[@type="checkbox"][@name="change_password"][@id="change-password"]' .
'[@data-role="change-password"][@value="1"][@title="Change Password"][@checked="checked"]' .
'[@class="checkbox"]';

$this->assertEquals(1, Xpath::getElementsCountForXpath($checkboxXpath, $body));
}

/**
Expand Down

0 comments on commit 8b7d949

Please sign in to comment.