/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/Persistent/Helper/SessionTest.php
80 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2020 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Persistent\Helper; use Magento\Framework\ObjectManagerInterface; use Magento\Persistent\Model\SessionFactory; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; /** * Test for persistent session helper * * @see \Magento\Persistent\Helper\Session * @magentoDbIsolation enabled * @magentoAppArea frontend */ class SessionTest extends TestCase { /** @var ObjectManagerInterface */ private $objectManager; /** @var Session */ private $helper; /** @var SessionFactory */ private $sessionFactory; /** * @inheritdoc */ public function setUp(): void { parent::setUp(); $this->objectManager = Bootstrap::getObjectManager(); $this->helper = $this->objectManager->get(Session::class); $this->sessionFactory = $this->objectManager->get(SessionFactory::class); } /** * @magentoDataFixture Magento/Persistent/_files/persistent.php * @magentoConfigFixture current_store persistent/options/enabled 1 * * @return void */ public function testPersistentEnabled(): void { $this->helper->setSession($this->sessionFactory->create()->loadByCustomerId(1)); $this->assertTrue($this->helper->isPersistent()); } /** * @magentoDataFixture Magento/Persistent/_files/persistent.php * @magentoConfigFixture current_store persistent/options/enabled 0 * * @return void */ public function testPersistentDisabled(): void { $this->helper->setSession($this->sessionFactory->create()->loadByCustomerId(1)); $this->assertFalse($this->helper->isPersistent()); } /** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoConfigFixture current_store persistent/options/enabled 1 * * @return void */ public function testCustomerWithoutPersistent(): void { $this->helper->setSession($this->sessionFactory->create()->loadByCustomerId(1)); $this->assertFalse($this->helper->isPersistent()); } }