Skip to content

Commit c6ad09a

Browse files
MAGETWO-98844: Maximum price is 100,000,000
1 parent acb44f6 commit c6ad09a

File tree

1 file changed

+41
-30
lines changed

1 file changed

+41
-30
lines changed

dev/tests/integration/testsuite/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricingTest.php

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,21 @@
66
namespace Magento\AdvancedPricingImportExport\Model\Export;
77

88
use Magento\Framework\App\Filesystem\DirectoryList;
9+
use Magento\TestFramework\Indexer\TestCase;
10+
use Magento\TestFramework\Helper\Bootstrap;
11+
use Magento\Framework\Filesystem;
12+
use Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing as ExportAdvancedPricing;
13+
use Magento\Catalog\Api\ProductRepositoryInterface;
14+
use Magento\Catalog\Model\Product;
15+
use Magento\ImportExport\Model\Export\Adapter\Csv as ExportAdapterCsv;
16+
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as ImportAdvancedPricing;
17+
use Magento\ImportExport\Model\Import\Source\Csv as ImportSourceCsv;
18+
use Magento\ImportExport\Model\Import;
919

10-
class AdvancedPricingTest extends \Magento\TestFramework\Indexer\TestCase
20+
/**
21+
* Advanced pricing test
22+
*/
23+
class AdvancedPricingTest extends TestCase
1124
{
1225
/**
1326
* @var \Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing
@@ -24,9 +37,11 @@ class AdvancedPricingTest extends \Magento\TestFramework\Indexer\TestCase
2437
*/
2538
protected $fileSystem;
2639

40+
// @codingStandardsIgnoreStart
2741
public static function setUpBeforeClass()
2842
{
29-
$db = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()
43+
$db = Bootstrap::getInstance()
44+
->getBootstrap()
3045
->getApplication()
3146
->getDbInstance();
3247
if (!$db->isDbDumpExists()) {
@@ -36,16 +51,15 @@ public static function setUpBeforeClass()
3651

3752
parent::setUpBeforeClass();
3853
}
54+
// @codingStandardsIgnoreEnd
3955

4056
protected function setUp()
4157
{
4258
parent::setUp();
4359

44-
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
45-
$this->fileSystem = $this->objectManager->get(\Magento\Framework\Filesystem::class);
46-
$this->model = $this->objectManager->create(
47-
\Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing::class
48-
);
60+
$this->objectManager = Bootstrap::getObjectManager();
61+
$this->fileSystem = $this->objectManager->get(Filesystem::class);
62+
$this->model = $this->objectManager->create(ExportAdvancedPricing::class);
4963
}
5064

5165
/**
@@ -56,16 +70,15 @@ protected function setUp()
5670
*/
5771
public function testExport()
5872
{
59-
$productRepository = $this->objectManager->create(
60-
\Magento\Catalog\Api\ProductRepositoryInterface::class
61-
);
73+
$productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
6274
$index = 0;
6375
$ids = [];
6476
$origPricingData = [];
6577
$skus = ['simple'];
6678
while (isset($skus[$index])) {
67-
$ids[$index] = $productRepository->get($skus[$index])->getId();
68-
$origPricingData[$index] = $this->objectManager->create(\Magento\Catalog\Model\Product::class)
79+
$ids[$index] = $productRepository->get($skus[$index])
80+
->getId();
81+
$origPricingData[$index] = $this->objectManager->create(Product::class)
6982
->load($ids[$index])
7083
->getTierPrices();
7184
$index++;
@@ -80,7 +93,7 @@ public function testExport()
8093

8194
while ($index > 0) {
8295
$index--;
83-
$newPricingData = $this->objectManager->create(\Magento\Catalog\Model\Product::class)
96+
$newPricingData = $this->objectManager->create(Product::class)
8497
->load($ids[$index])
8598
->getTierPrices();
8699
$this->assertEquals(count($origPricingData[$index]), count($newPricingData));
@@ -97,7 +110,7 @@ public function testExport()
97110
private function assertDiscountTypes($exportContent)
98111
{
99112
$this->assertContains(
100-
'2.0000,8.0000,Fixed',
113+
'2.0000,8.000000,Fixed',
101114
$exportContent
102115
);
103116
$this->assertContains(
@@ -115,16 +128,15 @@ private function assertDiscountTypes($exportContent)
115128
*/
116129
public function testExportMultipleWebsites()
117130
{
118-
$productRepository = $this->objectManager->create(
119-
\Magento\Catalog\Api\ProductRepositoryInterface::class
120-
);
131+
$productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
121132
$index = 0;
122133
$ids = [];
123134
$origPricingData = [];
124135
$skus = ['AdvancedPricingSimple 1', 'AdvancedPricingSimple 2'];
125136
while (isset($skus[$index])) {
126-
$ids[$index] = $productRepository->get($skus[$index])->getId();
127-
$origPricingData[$index] = $this->objectManager->create(\Magento\Catalog\Model\Product::class)
137+
$ids[$index] = $productRepository->get($skus[$index])
138+
->getId();
139+
$origPricingData[$index] = $this->objectManager->create(Product::class)
128140
->load($ids[$index])
129141
->getTierPrices();
130142
$index++;
@@ -141,7 +153,7 @@ public function testExportMultipleWebsites()
141153

142154
while ($index > 0) {
143155
$index--;
144-
$newPricingData = $this->objectManager->create(\Magento\Catalog\Model\Product::class)
156+
$newPricingData = $this->objectManager->create(Product::class)
145157
->load($ids[$index])
146158
->getTierPrices();
147159
$this->assertEquals(count($origPricingData[$index]), count($newPricingData));
@@ -156,10 +168,11 @@ public function testExportMultipleWebsites()
156168
private function exportData($csvFile)
157169
{
158170
$this->model->setWriter(
159-
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
160-
\Magento\ImportExport\Model\Export\Adapter\Csv::class,
161-
['fileSystem' => $this->fileSystem, 'destination' => $csvFile]
162-
)
171+
Bootstrap::getObjectManager()
172+
->create(
173+
ExportAdapterCsv::class,
174+
['fileSystem' => $this->fileSystem, 'destination' => $csvFile]
175+
)
163176
);
164177
$exportContent = $this->model->export();
165178
$this->assertNotEmpty($exportContent);
@@ -172,21 +185,19 @@ private function exportData($csvFile)
172185
*/
173186
private function importData($csvFile)
174187
{
175-
/** @var \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing $importModel */
176-
$importModel = $this->objectManager->create(
177-
\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class
178-
);
188+
/** @var ImportAdvancedPricing $importModel */
189+
$importModel = $this->objectManager->create(ImportAdvancedPricing::class);
179190
$directory = $this->fileSystem->getDirectoryWrite(DirectoryList::VAR_DIR);
180191
$source = $this->objectManager->create(
181-
\Magento\ImportExport\Model\Import\Source\Csv::class,
192+
ImportSourceCsv::class,
182193
[
183194
'file' => $csvFile,
184195
'directory' => $directory
185196
]
186197
);
187198
$errors = $importModel->setParameters(
188199
[
189-
'behavior' => \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND,
200+
'behavior' => Import::BEHAVIOR_APPEND,
190201
'entity' => 'advanced_pricing'
191202
]
192203
)->setSource(

0 commit comments

Comments
 (0)