Skip to content

Commit 91bead5

Browse files
committed
Deliver catalog storefront tests changes to mainline
1 parent b0b6b3f commit 91bead5

File tree

5 files changed

+43
-10
lines changed

5 files changed

+43
-10
lines changed

dev/tests/api-functional/testsuite/Magento/Webapi/JoinDirectivesTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ protected function setUp(): void
5050
*
5151
* @magentoApiDataFixture Magento/SalesRule/_files/rules_rollback.php
5252
* @magentoApiDataFixture Magento/Sales/_files/quote.php
53+
* @magentoAppIsolation enabled
5354
*/
5455
public function testGetList()
5556
{
@@ -87,6 +88,7 @@ public function testGetList()
8788

8889
/**
8990
* @magentoApiDataFixture Magento/Sales/_files/invoice.php
91+
* @magentoAppIsolation enabled
9092
*/
9193
public function testAutoGeneratedGetList()
9294
{
@@ -131,6 +133,7 @@ public function testAutoGeneratedGetList()
131133
* Test get list of orders with extension attributes.
132134
*
133135
* @magentoApiDataFixture Magento/Sales/_files/order.php
136+
* @magentoAppIsolation enabled
134137
*/
135138
public function testGetOrdertList()
136139
{

dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractBackendController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ protected function setUp(): void
6363
* If it will be created on test bootstrap we will have invalid RoleLocator object.
6464
* As tests by default are run not from adminhtml area...
6565
*/
66-
\Magento\TestFramework\ObjectManager::getInstance()->removeSharedInstance(\Magento\Framework\Authorization::class);
66+
\Magento\TestFramework\ObjectManager::getInstance()->removeSharedInstance(
67+
\Magento\Framework\Authorization::class
68+
);
6769
$this->_auth = $this->_objectManager->get(\Magento\Backend\Model\Auth::class);
6870
$this->_session = $this->_auth->getAuthStorage();
6971
$credentials = $this->_getAdminCredentials();

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend');
8+
9+
$storeManager = Magento\TestFramework\Helper\Bootstrap::getObjectManager()
10+
->get(\Magento\Store\Model\StoreManagerInterface::class);
711
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
812
$product->setTypeId('simple')
913
->setId(1)
@@ -23,7 +27,9 @@
2327
'is_in_stock' => 1,
2428
'manage_stock' => 1,
2529
]
26-
)->save();
30+
)
31+
->setWebsiteIds([$storeManager->getStore()->getWebsiteId()])
32+
->save();
2733

2834
$productRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
2935
->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
@@ -39,9 +45,7 @@
3945
$shippingAddress = clone $billingAddress;
4046
$shippingAddress->setId(null)->setAddressType('shipping');
4147

42-
$store = Magento\TestFramework\Helper\Bootstrap::getObjectManager()
43-
->get(\Magento\Store\Model\StoreManagerInterface::class)
44-
->getStore();
48+
$store = $storeManager->getStore();
4549

4650
/** @var \Magento\Quote\Model\Quote $quote */
4751
$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Quote\Model\Quote::class);

dev/tests/static/framework/Magento/TestFramework/Dependency/DbRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*/
88
namespace Magento\TestFramework\Dependency;
99

10+
/**
11+
* Class to get DB dependencies information
12+
*/
1013
class DbRule implements \Magento\TestFramework\Dependency\RuleInterface
1114
{
1215
/**
@@ -37,7 +40,7 @@ public function __construct(array $tables)
3740
*/
3841
public function getDependencyInfo($currentModule, $fileType, $file, &$contents)
3942
{
40-
if ('php' != $fileType || !preg_match('#.*/(Setup|Resource)/.*\.php$#', $file)) {
43+
if ('php' !== $fileType || !preg_match('#.*/(Setup|Resource|Query)/.*\.php$#', $file)) {
4144
return [];
4245
}
4346

dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,19 @@ public function testCodeStyle()
326326
touch($reportFile);
327327
}
328328
$codeSniffer = new CodeSniffer('Magento', $reportFile, new Wrapper());
329-
$result = $codeSniffer->run(
330-
$this->isFullScan() ? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml'])
331-
);
329+
$fileList = $this->isFullScan() ? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml']);
330+
$ignoreList = Files::init()->readLists(__DIR__ . '/_files/phpcs/ignorelist/*.txt');
331+
if ($ignoreList) {
332+
$ignoreListPattern = sprintf('#(%s)#i', implode('|', $ignoreList));
333+
$fileList = array_filter(
334+
$fileList,
335+
function ($path) use ($ignoreListPattern) {
336+
return !preg_match($ignoreListPattern, $path);
337+
}
338+
);
339+
}
340+
341+
$result = $codeSniffer->run($fileList);
332342
$report = file_get_contents($reportFile);
333343
$this->assertEquals(
334344
0,
@@ -348,8 +358,19 @@ public function testCodeMess()
348358
if (!$codeMessDetector->canRun()) {
349359
$this->markTestSkipped('PHP Mess Detector is not available.');
350360
}
361+
$fileList = self::getWhitelist(['php']);
362+
$ignoreList = Files::init()->readLists(__DIR__ . '/_files/phpmd/ignorelist/*.txt');
363+
if ($ignoreList) {
364+
$ignoreListPattern = sprintf('#(%s)#i', implode('|', $ignoreList));
365+
$fileList = array_filter(
366+
$fileList,
367+
function ($path) use ($ignoreListPattern) {
368+
return !preg_match($ignoreListPattern, $path);
369+
}
370+
);
371+
}
351372

352-
$result = $codeMessDetector->run(self::getWhitelist(['php']));
373+
$result = $codeMessDetector->run($fileList);
353374

354375
$output = "";
355376
if (file_exists($reportFile)) {

0 commit comments

Comments
 (0)