Skip to content

Commit fdbfa2f

Browse files
committed
Merge branch 'MAGETWO-99376' into 'MC-18826'
MC-18826: Increase test coverage for Cart & Checkout and Order Processing functional areas See merge request magn-m23/magn-m23!1656
2 parents 9e09b84 + ada23e3 commit fdbfa2f

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

dev/tests/integration/testsuite/Magento/Sales/Model/ResourceModel/OrderTest.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
use Magento\Store\Api\StoreRepositoryInterface;
1111
use Magento\Store\Model\StoreManagerInterface;
1212
use Magento\Framework\Event\ManagerInterface;
13+
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory;
1314

15+
/**
16+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
*/
1418
class OrderTest extends \PHPUnit\Framework\TestCase
1519
{
1620
/**
@@ -59,10 +63,10 @@ protected function tearDown()
5963
$registry->unregister('isSecureArea');
6064
$registry->register('isSecureArea', true);
6165

62-
/** @var \Magento\Sales\Model\Order $order */
63-
$order = $this->objectManager->create(\Magento\Sales\Model\Order::class);
64-
$order->loadByIncrementId($this->orderIncrementId);
65-
$order->delete();
66+
$orderCollection = $this->objectManager->create(OrderCollectionFactory::class)->create();
67+
foreach ($orderCollection as $order) {
68+
$order->delete();
69+
}
6670

6771
$registry->unregister('isSecureArea');
6872
$registry->register('isSecureArea', false);
@@ -140,11 +144,11 @@ public function testSaveOrder()
140144
* Check that store name with length within 255 chars can be saved in table sales_order
141145
*
142146
* @magentoDataFixture Magento/Store/_files/store_with_long_name.php
147+
* @magentoDbIsolation disabled
143148
* @return void
144149
*/
145150
public function testSaveStoreName()
146151
{
147-
$storeName = str_repeat('a', 220);
148152
$store = $this->storeRepository->get('test_2');
149153
$this->storeManager->setCurrentStore($store->getId());
150154
$eventManager = $this->objectManager->get(ManagerInterface::class);
@@ -154,13 +158,10 @@ public function testSaveStoreName()
154158
$payment->setMethod('checkmo');
155159
$order->setStoreId($store->getId())->setPayment($payment);
156160
$this->resourceModel->save($order);
157-
$this->resourceModel->load($order, $storeName, 'store_name');
158-
$name = [
159-
'Main Website',
160-
'Main Website Store',
161-
$storeName,
162-
];
163-
$expectedStoreName = implode(PHP_EOL, $name);
164-
$this->assertEquals($expectedStoreName, $order->getStoreName());
161+
$orderRepository = $this->objectManager->create(\Magento\Sales\Api\OrderRepositoryInterface::class);
162+
$order = $orderRepository->get($order->getId());
163+
$this->assertEquals(255, strlen($order->getStoreName()));
164+
$this->assertContains($store->getWebsite()->getName(), $order->getStoreName());
165+
$this->assertContains($store->getGroup()->getName(), $order->getStoreName());
165166
}
166167
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/** @var $store \Magento\Store\Model\Store */
99
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class);
10-
$storeName = str_repeat('a', 220);
10+
$storeName = str_repeat('a', 255);
1111
if (!$store->load('test', 'code')->getId()) {
1212
$store->setData(
1313
[

0 commit comments

Comments
 (0)