/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/InstantPurchase/CustomerData/InstantPurchaseTest.php
75 строк
3 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2017 Adobe * All Rights Reserved. */ namespace Magento\InstantPurchase\CustomerData; use Magento\Framework\ObjectManagerInterface; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; use Magento\Customer\Model\Session; /** * @magentoAppIsolation enabled */ class InstantPurchaseTest extends TestCase { /** * @var ObjectManagerInterface */ private $objectManager; protected function setUp(): void { $this->objectManager = Bootstrap::getObjectManager(); } /** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_address.php * @magentoDataFixture Magento/InstantPurchase/_files/fake_payment_token.php */ public function testDefaultFormatterIsAppliedWhenBasicIntegration() { /** @var Session $customerSession */ $customerSession = $this->objectManager->get(Session::class); $customerSession->loginById(1); /** @var InstantPurchase $customerDataSectionSource */ $customerDataSectionSource = $this->objectManager->get(InstantPurchase::class); $data = $customerDataSectionSource->getSectionData(); $this->assertEquals( 'Fake Payment Method Vault', $data['paymentToken']['summary'], 'Basic implementation returns provider title.' ); } /** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_address.php * @magentoDataFixture Magento/InstantPurchase/_files/fake_payment_token.php * @magentoConfigFixture current_store payment/fake_vault/instant_purchase/tokenFormat StubFormatter */ public function testCustomFormatterIsAppliedWhenComplexIntegration() { $this->objectManager->configure([ 'StubFormatter' => [ 'type' => StubPaymentTokenFormatter::class, ], ]); /** @var Session $customerSession */ $customerSession = $this->objectManager->get(Session::class); $customerSession->loginById(1); /** @var InstantPurchase $customerDataSectionSource */ $customerDataSectionSource = $this->objectManager->get(InstantPurchase::class); $data = $customerDataSectionSource->getSectionData(); $this->assertEquals( StubPaymentTokenFormatter::VALUE, $data['paymentToken']['summary'], 'Complex implementation returns custom string.' ); } }