Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/dev/tests/integration/testsuite/Magento/Store/_files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/dev/tests/integration/testsuite/Magento/Store/_files/multiple_currencies.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

use Magento\Config\App\Config\Type\System as Config;
use Magento\Config\Model\ResourceModel\Config as ConfigResource;
use Magento\Directory\Model\Currency;
use Magento\Directory\Model\ResourceModel\Currency as CurrencyResource;
use Magento\Store\Model\ScopeInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\Store\Model\Store;

$objectManager = Bootstrap::getObjectManager();
/** @var Store $store */
$store = $objectManager->create(Store::class);
$storeId = $store->load('default', 'code')->getId();

/** @var ConfigResource $configResource */
$configResource = $objectManager->get(ConfigResource::class);
$configResource->saveConfig(
    Currency::XML_PATH_CURRENCY_ALLOW,
    'USD,EUR',
    ScopeInterface::SCOPE_STORES,
    $storeId
);

/**
 * Configuration cache clean is required to reload currency setting
 */
/** @var Config $config */
$config = $objectManager->get(Config::class);
$config->clean();

/** @var CurrencyResource $currencyResource */
$currencyResource = $objectManager->create(CurrencyResource::class);
$currencyResource->saveRates(
    [
        'USD' => ['EUR' => 2],
        'EUR' => ['USD' => 0.5]
    ]
);

Spamworldpro Mini