Skip to content

Commit 050e998

Browse files
committed
MAGETWO-62783: Wrong address template used for order e-mails
1 parent e627318 commit 050e998

File tree

3 files changed

+41
-43
lines changed

3 files changed

+41
-43
lines changed

dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,54 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
9-
require __DIR__ . '/../../../Magento/Store/_files/core_fixturestore.php';
10-
11-
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
12-
13-
$objectManager->get(\Magento\Framework\Indexer\IndexerRegistry::class)
14-
->get('catalogsearch_fulltext')
7+
use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper;
8+
use Magento\Framework\Indexer\IndexerRegistry;
9+
use Magento\CatalogSearch\Model\Indexer\Fulltext as FulltextIndexer;
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Sales\Model\Order\Address as OrderAddress;
12+
use Magento\Sales\Model\Order\Payment as OrderPayment;
13+
use Magento\Sales\Model\Order\Item as OrderItem;
14+
use Magento\Sales\Model\Order;
15+
use Magento\Store\Model\StoreManagerInterface;
16+
17+
require __DIR__ . '/../../Store/_files/core_fixturestore.php';
18+
19+
$objectManager = BootstrapHelper::getObjectManager();
20+
21+
$objectManager->get(IndexerRegistry::class)
22+
->get(FulltextIndexer::INDEXER_ID)
1523
->reindexAll();
1624

17-
require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_duplicated.php';
18-
/** @var \Magento\Catalog\Model\Product $product */
25+
require __DIR__ . '/../../Catalog/_files/product_simple_duplicated.php';
26+
/** @var Product $product */
1927

2028
$addressData = include __DIR__ . '/address_data.php';
2129

22-
$billingAddress = $objectManager->create(\Magento\Sales\Model\Order\Address::class, ['data' => $addressData]);
30+
$billingAddress = $objectManager->create(OrderAddress::class, ['data' => $addressData]);
2331
$billingAddress->setAddressType('billing');
2432

2533
$shippingAddress = clone $billingAddress;
2634
$shippingAddress->setId(null)->setAddressType('shipping');
2735

28-
$payment = $objectManager->create(\Magento\Sales\Model\Order\Payment::class);
36+
$payment = $objectManager->create(OrderPayment::class);
2937
$payment->setMethod('checkmo');
3038

31-
/** @var \Magento\Sales\Model\Order\Item $orderItem */
32-
$orderItem = $objectManager->create(\Magento\Sales\Model\Order\Item::class);
39+
/** @var OrderItem $orderItem */
40+
$orderItem = $objectManager->create(OrderItem::class);
3341
$orderItem->setProductId($product->getId())->setQtyOrdered(2);
3442

35-
/** @var \Magento\Sales\Model\Order $order */
36-
$order = $objectManager->create(\Magento\Sales\Model\Order::class);
37-
$order->setIncrementId(
38-
'100000004'
39-
)->setState(
40-
\Magento\Sales\Model\Order::STATE_PROCESSING
41-
)->setStatus(
42-
$order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_PROCESSING)
43-
)->setSubtotal(
44-
100
45-
)->setBaseSubtotal(
46-
100
47-
)->setCustomerIsGuest(
48-
true
49-
)->setCustomerEmail(
50-
51-
)->setBillingAddress(
52-
$billingAddress
53-
)->setShippingAddress(
54-
$shippingAddress
55-
)->setStoreId(
56-
$objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)->getStore('fixturestore')->getId()
57-
)->addItem(
58-
$orderItem
59-
)->setPayment(
60-
$payment
61-
);
62-
$order->save();
43+
/** @var Order $order */
44+
$order = $objectManager->create(Order::class);
45+
$order->setIncrementId('100000004')
46+
->setState(Order::STATE_PROCESSING)
47+
->setStatus($order->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING))
48+
->setSubtotal(100)
49+
->setBaseSubtotal(100)
50+
->setCustomerIsGuest(true)
51+
->setCustomerEmail('[email protected]')
52+
->setBillingAddress($billingAddress)
53+
->setShippingAddress($shippingAddress)
54+
->setStoreId($objectManager->get(StoreManagerInterface::class)->getStore('fixturestore')->getId())
55+
->addItem($orderItem)
56+
->setPayment($payment)
57+
->save();

dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store_rollback.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
use Magento\TestFramework\Helper\Bootstrap;
88
use Magento\Framework\Indexer\IndexerRegistry;
9+
use Magento\CatalogSearch\Model\Indexer\Fulltext as FulltextIndexer;
910

1011
require __DIR__ . '/default_rollback.php';
1112
require __DIR__ . '/../../Catalog/_files/product_simple_duplicated_rollback.php';
1213
require __DIR__ . '/../../Store/_files/core_fixturestore_rollback.php';
1314

1415
Bootstrap::getObjectManager()->get(IndexerRegistry::class)
15-
->get('catalogsearch_fulltext')
16+
->get(FulltextIndexer::INDEXER_ID)
1617
->reindexAll();

dev/tests/integration/testsuite/Magento/Store/_files/core_fixturestore.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@
2525
/* Refresh stores memory cache */
2626
Bootstrap::getObjectManager()->get(\Magento\Store\Model\StoreManagerInterface::class)->reinitStores();
2727
}
28+
29+
//if test using this fixture relies on full text functionality it is required to explicitly perform re-indexation

0 commit comments

Comments
 (0)