@magentoDataFixture Magento/Persistent/_files/persistent.php @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 15 of file ObserverTest.php.
◆ setUp()
Definition at line 57 of file ObserverTest.php.
61 $this->_customerSession = $this->_objectManager->get(\
Magento\Customer\Model\Session::class);
63 $this->_customerViewHelper = $this->_objectManager->create(
64 \
Magento\Customer\Helper\View::class
66 $this->_escaper = $this->_objectManager->create(
67 \
Magento\Framework\Escaper::class
70 $this->customerRepository = $this->_objectManager->create(
71 \
Magento\Customer\Api\CustomerRepositoryInterface::class
74 $this->_checkoutSession = $this->getMockBuilder(
75 \
Magento\Checkout\Model\Session::class
76 )->disableOriginalConstructor()->setMethods([])->getMock();
78 $this->_persistentSessionHelper = $this->_objectManager->create(\
Magento\Persistent\Helper\Session::class);
80 $this->_observer = $this->_objectManager->create(
81 \
Magento\Persistent\Model\Observer::class,
83 'escaper' => $this->_escaper,
84 'customerViewHelper' => $this->_customerViewHelper,
85 'customerRepository' => $this->customerRepository,
86 'checkoutSession' => $this->_checkoutSession
static getObjectManager()
◆ testEmulateWelcomeBlock()
testEmulateWelcomeBlock |
( |
| ) |
|
@magentoConfigFixture current_store persistent/options/enabled 1 @magentoConfigFixture current_store persistent/options/remember_enabled 1 @magentoConfigFixture current_store persistent/options/remember_default 1 @magentoAppArea frontend @magentoAppIsolation enabled
Definition at line 98 of file ObserverTest.php.
100 $this->_customerSession->loginById(1);
102 $httpContext = new \Magento\Framework\App\Http\Context();
104 $block = $this->_objectManager->create(
105 \
Magento\Sales\Block\Reorder\Sidebar::class,
107 'httpContext' => $httpContext
110 $this->_observer->emulateWelcomeBlock(
$block);
111 $customerName = $this->_escaper->escapeHtml(
112 $this->_customerViewHelper->getCustomerName(
113 $this->customerRepository->getById(
114 $this->_persistentSessionHelper->getSession()->getCustomerId()
118 $translation =
__(
'Welcome, %1!', $customerName)->__toString();
119 $this->assertStringMatchesFormat(
'%A' . $translation .
'%A',
$block->getWelcome()->__toString());
120 $this->_customerSession->logout();
◆ $_checkoutSession
◆ $_customerSession
◆ $_customerViewHelper
◆ $_escaper
◆ $_objectManager
◆ $_observer
◆ $_persistentSessionHelper
$_persistentSessionHelper |
|
protected |
◆ $customerRepository
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Persistent/Model/ObserverTest.php