|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | +declare(strict_types=1); |
| 7 | + |
| 8 | +namespace Magento\Reports\Controller\Adminhtml\Report\Sales; |
| 9 | + |
| 10 | +use Magento\Catalog\Test\Fixture\Product as ProductFixture; |
| 11 | +use Magento\Checkout\Test\Fixture\PlaceOrder as PlaceOrderFixture; |
| 12 | +use Magento\Checkout\Test\Fixture\SetBillingAddress as SetBillingAddressFixture; |
| 13 | +use Magento\Checkout\Test\Fixture\SetDeliveryMethod as SetDeliveryMethodFixture; |
| 14 | +use Magento\Checkout\Test\Fixture\SetPaymentMethod as SetPaymentMethodFixture; |
| 15 | +use Magento\Checkout\Test\Fixture\SetShippingAddress as SetShippingAddressFixture; |
| 16 | +use Magento\Customer\Test\Fixture\Customer; |
| 17 | +use Magento\Directory\Test\Fixture\CurrencyRate; |
| 18 | +use Magento\Quote\Test\Fixture\AddProductToCart as AddProductToCartFixture; |
| 19 | +use Magento\Quote\Test\Fixture\CustomerCart; |
| 20 | +use Magento\Store\Model\ScopeInterface; |
| 21 | +use Magento\Store\Test\Fixture\Group as StoreGroupFixture; |
| 22 | +use Magento\Store\Test\Fixture\Store as StoreFixture; |
| 23 | +use Magento\Store\Test\Fixture\Website as WebsiteFixture; |
| 24 | +use Magento\TestFramework\Fixture\AppArea; |
| 25 | +use Magento\TestFramework\Fixture\Config as Config; |
| 26 | +use Magento\TestFramework\Fixture\DataFixture; |
| 27 | +use Magento\TestFramework\Fixture\DataFixtureStorageManager; |
| 28 | +use Magento\TestFramework\Fixture\DbIsolation; |
| 29 | +use Magento\TestFramework\Helper\Bootstrap; |
| 30 | +use Magento\TestFramework\TestCase\AbstractController; |
| 31 | + |
| 32 | +class AdminOrderReports extends AbstractController |
| 33 | +{ |
| 34 | + #[ |
| 35 | + DbIsolation(false), |
| 36 | + AppArea('adminhtml'), |
| 37 | + Config('catalog/price/scope', 1), |
| 38 | + DataFixture(WebsiteFixture::class, as: 'website2'), |
| 39 | + DataFixture(StoreGroupFixture::class, ['website_id' => '$website2.id$'], 'group2'), |
| 40 | + DataFixture(StoreFixture::class, ['store_group_id' => '$group2.id$'], 'store2'), |
| 41 | + Config('currency/options/default', 'EUR', ScopeInterface::SCOPE_WEBSITE, '$website2.code$'), |
| 42 | + Config('currency/options/allow', 'EUR', ScopeInterface::SCOPE_WEBSITE, '$website2.code$'), |
| 43 | + DataFixture(CurrencyRate::class, ['USD' => ['EUR' => 0.8]]), |
| 44 | + DataFixture(ProductFixture::class, ['website_ids' => [1, '$website2.id$']], as: 'p1'), |
| 45 | + DataFixture(Customer::class, ['website_id' => '$website2.id$'], as: 'customer'), |
| 46 | + DataFixture(CustomerCart::class, ['customer_id' => '$customer.id$'], as: 'cart'), |
| 47 | + DataFixture( |
| 48 | + AddProductToCartFixture::class, |
| 49 | + ['cart_id' => '$cart.id$', 'product_id' => '$p1.id$', 'qty' => 1] |
| 50 | + ), |
| 51 | + DataFixture(SetBillingAddressFixture::class, ['cart_id' => '$cart.id$'], as: 'billingAddress'), |
| 52 | + DataFixture(SetShippingAddressFixture::class, ['cart_id' => '$cart.id$'], as: 'shippingAddress'), |
| 53 | + DataFixture(SetDeliveryMethodFixture::class, ['cart_id' => '$cart.id$']), |
| 54 | + DataFixture(SetPaymentMethodFixture::class, ['cart_id' => '$cart.id$']), |
| 55 | + DataFixture(PlaceOrderFixture::class, ['cart_id' => '$cart.id$'], as: 'order'), |
| 56 | + ] |
| 57 | + public function testAdminOrderReportsForMultiWebsiteWithDifferentDisplayCurrencyT() |
| 58 | + { |
| 59 | + $order = Bootstrap::getObjectManager()->get(DataFixtureStorageManager::class)->getStorage()->get('order'); |
| 60 | + $this->assertNotEmpty($order->getEntityId()); |
| 61 | + } |
| 62 | +} |
0 commit comments