Skip to content

Commit

Permalink
[17] Merge api-proto with develop #71
Browse files Browse the repository at this point in the history
  • Loading branch information
le0n4ik committed Jun 12, 2020
1 parent 8513dfd commit 2916519
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ protected function setUp(): void
*
* @magentoApiDataFixture Magento/SalesRule/_files/rules_rollback.php
* @magentoApiDataFixture Magento/Sales/_files/quote.php
* @magentoAppIsolation enabled
*/
public function testGetList()
{
Expand Down Expand Up @@ -87,6 +88,7 @@ public function testGetList()

/**
* @magentoApiDataFixture Magento/Sales/_files/invoice.php
* @magentoAppIsolation enabled
*/
public function testAutoGeneratedGetList()
{
Expand Down Expand Up @@ -131,6 +133,7 @@ public function testAutoGeneratedGetList()
* Test get list of orders with extension attributes.
*
* @magentoApiDataFixture Magento/Sales/_files/order.php
* @magentoAppIsolation enabled
*/
public function testGetOrdertList()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ public function __construct(
$loadTestExtensionAttributes = false
) {
if (getcwd() != BP . '/dev/tests/integration') {
// phpcs:ignore Magento2.Functions.DiscouragedFunction
chdir(BP . '/dev/tests/integration');
}
$this->_shell = $shell;
$this->installConfigFile = $installConfigFile;
// phpcs:ignore Magento2.Functions.DiscouragedFunction
$this->_globalConfigDir = realpath($globalConfigDir);
$this->_appMode = $appMode;
$this->installDir = $installDir;
Expand Down Expand Up @@ -251,6 +253,7 @@ public function getDbInstance()
protected function getInstallConfig()
{
if (null === $this->installConfig) {
// phpcs:ignore Magento2.Security.IncludeFile
$this->installConfig = include $this->installConfigFile;
}
return $this->installConfig;
Expand Down Expand Up @@ -293,6 +296,7 @@ public function getInitParams()
*/
public function isInstalled()
{
// phpcs:ignore Magento2.Functions.DiscouragedFunction
return is_file($this->getLocalConfig());
}

Expand Down Expand Up @@ -419,11 +423,23 @@ public function initialize($overriddenParams = [])
$sequence = $objectManager->get(\Magento\TestFramework\Db\Sequence::class);
$sequence->generateSequences();
}

$this->createDynamicTables();
$objectManager->create(\Magento\TestFramework\Config::class, ['configPath' => $this->globalConfigFile])
->rewriteAdditionalConfig();
}

/**
* Create dynamic tables
*
* @return void
*/
protected function createDynamicTables()
{
/** @var \Magento\TestFramework\Db\DynamicTables $dynamicTables */
$dynamicTables = Helper\Bootstrap::getObjectManager()->get(\Magento\TestFramework\Db\DynamicTables::class);
$dynamicTables->createTables();
}

/**
* Reset and initialize again an already installed application
*
Expand Down Expand Up @@ -552,8 +568,10 @@ private function copyAppConfigFiles()
);
foreach ($globalConfigFiles as $file) {
$targetFile = $this->_configDir . str_replace($this->_globalConfigDir, '', $file);
// phpcs:ignore Magento2.Functions.DiscouragedFunction
$this->_ensureDirExists(dirname($targetFile));
if ($file !== $targetFile) {
// phpcs:ignore Magento2.Functions.DiscouragedFunction
copy($file, $targetFile);
}
}
Expand All @@ -567,6 +585,7 @@ private function copyAppConfigFiles()
private function copyGlobalConfigFile()
{
$targetFile = $this->_configDir . '/config.local.php';
// phpcs:ignore Magento2.Functions.DiscouragedFunction
copy($this->globalConfigFile, $targetFile);
}

Expand Down Expand Up @@ -636,10 +655,13 @@ protected function _resetApp()
*/
protected function _ensureDirExists($dir)
{
// phpcs:ignore Magento2.Functions.DiscouragedFunction
if (!file_exists($dir)) {
$old = umask(0);
// phpcs:ignore Magento2.Functions.DiscouragedFunction
mkdir($dir, 0777, true);
umask($old);
// phpcs:ignore Magento2.Functions.DiscouragedFunction
} elseif (!is_dir($dir)) {
throw new \Magento\Framework\Exception\LocalizedException(__("'%1' is not a directory.", $dir));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public function testAlreadyExistsExceptionProcessingWhenGroupCodeIsDuplicated():
*/
public function testRemoveAttributeFromAttributeSet(): void
{
$this->markTestSkipped('ECP-739');
$message = 'Attempt to load value of nonexistent EAV attribute';
$this->removeSyslog();
$attributeSet = $this->getAttributeSetByName('new_attribute_set');
Expand Down
12 changes: 8 additions & 4 deletions dev/tests/integration/testsuite/Magento/Sales/_files/quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend');

$storeManager = Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->get(\Magento\Store\Model\StoreManagerInterface::class);
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class);
$product->setTypeId('simple')
->setId(1)
Expand All @@ -23,7 +27,9 @@
'is_in_stock' => 1,
'manage_stock' => 1,
]
)->save();
)
->setWebsiteIds([$storeManager->getStore()->getWebsiteId()])
->save();

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

$store = Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->get(\Magento\Store\Model\StoreManagerInterface::class)
->getStore();
$store = $storeManager->getStore();

/** @var \Magento\Quote\Model\Quote $quote */
$quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Quote\Model\Quote::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,21 @@ class SetupApplication extends Application
protected $canInstallSequence = false;

/**
* {@inheritdoc}
* @inheritdoc
*/
public function run()
{
// phpcs:ignore Magento2.Exceptions.DirectThrow
throw new \Exception("Can't start application.");
}

/**
* Create dynamic tables
*
* @return null
*/
protected function createDynamicTables()
{
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
namespace Magento\TestFramework\Dependency;

/**
* Class to get DB dependencies information
*/
class DbRule implements \Magento\TestFramework\Dependency\RuleInterface
{
/**
Expand Down Expand Up @@ -37,7 +40,7 @@ public function __construct(array $tables)
*/
public function getDependencyInfo($currentModule, $fileType, $file, &$contents)
{
if ('php' != $fileType || !preg_match('#.*/(Setup|Resource)/.*\.php$#', $file)) {
if ('php' != $fileType || !preg_match('#.*/(Setup|Resource|Query)/.*\.php$#', $file)) {
return [];
}

Expand Down

0 comments on commit 2916519

Please sign in to comment.