Skip to content

Commit e2c33da

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'MTA-1284' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop
2 parents 4f25bdd + 77a9441 commit e2c33da

File tree

13 files changed

+227
-112
lines changed

13 files changed

+227
-112
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
namespace Magento\Catalog\Test\TestCase\ProductAttribute;
88

9-
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10-
use Magento\Catalog\Test\Fixture\CatalogProductSimple;
119
use Magento\Mtf\Fixture\FixtureFactory;
12-
use Magento\Mtf\ObjectManager;
1310
use Magento\Mtf\TestCase\Scenario;
1411

1512
/**
@@ -40,13 +37,6 @@ class CreateProductAttributeEntityFromProductPageTest extends Scenario
4037
const TO_MAINTAIN = 'yes';
4138
/* end tags */
4239

43-
/**
44-
* CatalogProductAttribute fixture.
45-
*
46-
* @var CatalogProductAttribute
47-
*/
48-
protected $attribute;
49-
5040
/**
5141
* Prepare data for test.
5242
*
@@ -66,25 +56,10 @@ public function __prepare(FixtureFactory $fixtureFactory)
6656
/**
6757
* Run CreateProductAttributeEntity from product page test.
6858
*
69-
* @param CatalogProductAttribute $attribute
7059
* @return void
7160
*/
72-
public function test(CatalogProductAttribute $attribute)
61+
public function test()
7362
{
74-
$this->attribute = $attribute;
7563
$this->executeScenario();
7664
}
77-
78-
/**
79-
* Delete attribute after test.
80-
*
81-
* @return void
82-
*/
83-
public function tearDown()
84-
{
85-
ObjectManager::getInstance()->create(
86-
'Magento\Catalog\Test\TestStep\DeleteAttributeStep',
87-
['attribute' => $this->attribute]
88-
)->run();
89-
}
9065
}

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.php

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
namespace Magento\Catalog\Test\TestCase\ProductAttribute;
88

9-
use Magento\Catalog\Test\Fixture\CatalogProductAttribute;
10-
use Magento\Mtf\ObjectManager;
119
use Magento\Mtf\TestCase\Scenario;
1210

1311
/**
@@ -29,35 +27,13 @@ class CreateProductAttributeEntityTest extends Scenario
2927
const DOMAIN = 'MX';
3028
/* end tags */
3129

32-
/**
33-
* CatalogProductAttribute object.
34-
*
35-
* @var CatalogProductAttribute
36-
*/
37-
protected $attribute;
38-
3930
/**
4031
* Run CreateProductAttributeEntity test.
4132
*
42-
* @param CatalogProductAttribute $productAttribute
4333
* @return array
4434
*/
45-
public function testCreateProductAttribute(CatalogProductAttribute $productAttribute)
35+
public function testCreateProductAttribute()
4636
{
47-
$this->attribute = $productAttribute;
4837
$this->executeScenario();
4938
}
50-
51-
/**
52-
* Delete attribute after test.
53-
*
54-
* @return void
55-
*/
56-
public function tearDown()
57-
{
58-
ObjectManager::getInstance()->create(
59-
'Magento\Catalog\Test\TestStep\DeleteAttributeStep',
60-
['attribute' => $this->attribute]
61-
)->run();
62-
}
6339
}

dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/SaveAttributeStep.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,22 @@ class SaveAttributeStep implements TestStepInterface
2121
*/
2222
protected $attributeNew;
2323

24+
/**
25+
* Delete attribute step.
26+
*
27+
* @var DeleteAttributeStep
28+
*/
29+
protected $deleteAttribute;
30+
2431
/**
2532
* @constructor
2633
* @param CatalogProductAttributeNew $attributeNew
34+
* @param DeleteAttributeStep $deleteAttribute
2735
*/
28-
public function __construct(CatalogProductAttributeNew $attributeNew)
36+
public function __construct(CatalogProductAttributeNew $attributeNew, DeleteAttributeStep $deleteAttribute)
2937
{
3038
$this->attributeNew = $attributeNew;
39+
$this->deleteAttribute = $deleteAttribute;
3140
}
3241

3342
/**
@@ -39,4 +48,14 @@ public function run()
3948
{
4049
$this->attributeNew->getPageActions()->save();
4150
}
51+
52+
/**
53+
* Delete attribute after test.
54+
*
55+
* @return void
56+
*/
57+
public function cleanup()
58+
{
59+
$this->deleteAttribute->run();
60+
}
4261
}

dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/CreateCatalogRuleStep.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,26 @@ class CreateCatalogRuleStep implements TestStepInterface
2828
*/
2929
protected $fixtureFactory;
3030

31+
/**
32+
* Delete all catalog rules step.
33+
*
34+
* @var $deleteAllCatalogRule
35+
*/
36+
protected $deleteAllCatalogRule;
37+
3138
/**
3239
* Preparing step properties
3340
*
3441
* @constructor
3542
* @param FixtureFactory $fixtureFactory
3643
* @param string $catalogRule
44+
* @param DeleteAllCatalogRulesStep $deleteRule
3745
*/
38-
public function __construct(FixtureFactory $fixtureFactory, $catalogRule)
46+
public function __construct(FixtureFactory $fixtureFactory, DeleteAllCatalogRulesStep $deleteRule, $catalogRule)
3947
{
4048
$this->fixtureFactory = $fixtureFactory;
4149
$this->catalogRule = $catalogRule;
50+
$this->deleteAllCatalogRule = $deleteRule;
4251
}
4352

4453
/**
@@ -59,4 +68,14 @@ public function run()
5968
}
6069
return $result;
6170
}
71+
72+
/**
73+
* Delete all catalog rule.
74+
*
75+
* @return void
76+
*/
77+
public function cleanup()
78+
{
79+
$this->deleteAllCatalogRule->run();
80+
}
6281
}

dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,15 @@ public function run()
7575

7676
return ['config' => $result];
7777
}
78+
79+
/**
80+
* Rollback configuration.
81+
*
82+
* @return void
83+
*/
84+
public function cleanup()
85+
{
86+
$this->rollback = true;
87+
$this->run();
88+
}
7889
}

dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,30 @@ class LoginCustomerOnFrontendStep implements TestStepInterface
3737
*/
3838
protected $customerAccountLogin;
3939

40+
/**
41+
* Logout customer on frontend step.
42+
*
43+
* @var LogoutCustomerOnFrontendStep
44+
*/
45+
protected $logoutCustomerOnFrontend;
46+
4047
/**
4148
* @constructor
4249
* @param CmsIndex $cmsIndex
4350
* @param CustomerAccountLogin $customerAccountLogin
51+
* @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend
4452
* @param Customer $customer
4553
*/
4654
public function __construct(
4755
CmsIndex $cmsIndex,
4856
CustomerAccountLogin $customerAccountLogin,
57+
LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend,
4958
Customer $customer
5059
) {
5160
$this->cmsIndex = $cmsIndex;
5261
$this->customerAccountLogin = $customerAccountLogin;
5362
$this->customer = $customer;
63+
$this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend;
5464
}
5565

5666
/**
@@ -71,4 +81,14 @@ public function run()
7181
$this->cmsIndex->getCmsPageBlock()->waitPageInit();
7282
$this->customerAccountLogin->getLoginBlock()->login($this->customer);
7383
}
84+
85+
/**
86+
* Logout customer on fronted.
87+
*
88+
* @return void
89+
*/
90+
public function cleanup()
91+
{
92+
$this->logoutCustomerOnFrontend->run();
93+
}
7494
}

dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,4 @@ public function test()
4747
{
4848
$this->executeScenario();
4949
}
50-
51-
/**
52-
* Disable enabled config after test.
53-
*
54-
* @return void
55-
*/
56-
public function tearDown()
57-
{
58-
if (isset($this->currentVariation['arguments']['configData'])) {
59-
$this->objectManager->create(
60-
'Magento\Config\Test\TestStep\SetupConfigurationStep',
61-
['configData' => $this->currentVariation['arguments']['configData'], 'rollback' => true]
62-
)->run();
63-
}
64-
$this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run();
65-
$this->objectManager->create('Magento\Tax\Test\TestStep\DeleteAllTaxRulesStep')->run();
66-
}
6750
}

dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/PrintOrderFrontendGuestTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public function test()
7070
*/
7171
public function tearDown()
7272
{
73-
$this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run();
7473
$this->browser->closeWindow();
7574
}
7675
}

dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,4 @@ public function test()
4141
{
4242
$this->executeScenario();
4343
}
44-
45-
/**
46-
* Disable enabled config after test.
47-
*
48-
* @return void
49-
*/
50-
public function tearDown()
51-
{
52-
if (isset($this->currentVariation['arguments']['configData'])) {
53-
$setConfigStep = $this->objectManager->create(
54-
'Magento\Config\Test\TestStep\SetupConfigurationStep',
55-
['configData' => $this->currentVariation['arguments']['configData'], 'rollback' => true]
56-
);
57-
$setConfigStep->run();
58-
}
59-
$this->objectManager->create('Magento\SalesRule\Test\TestStep\DeleteAllSalesRuleStep')->run();
60-
}
6144
}

dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,26 @@ class CreateSalesRuleStep implements TestStepInterface
2828
*/
2929
protected $fixtureFactory;
3030

31+
/**
32+
* Delete all Sales Rule on backend.
33+
*
34+
* @var DeleteAllSalesRuleStep
35+
*/
36+
protected $deleteAllSalesRule;
37+
3138
/**
3239
* Preparing step properties.
3340
*
3441
* @constructor
3542
* @param FixtureFactory $fixtureFactory
43+
* @param DeleteAllSalesRuleStep $deleteRule
3644
* @param string $salesRule
3745
*/
38-
public function __construct(FixtureFactory $fixtureFactory, $salesRule = null)
46+
public function __construct(FixtureFactory $fixtureFactory, DeleteAllSalesRuleStep $deleteRule, $salesRule = null)
3947
{
4048
$this->fixtureFactory = $fixtureFactory;
4149
$this->salesRule = $salesRule;
50+
$this->deleteAllSalesRule = $deleteRule;
4251
}
4352

4453
/**
@@ -60,4 +69,14 @@ public function run()
6069

6170
return $result;
6271
}
72+
73+
/**
74+
* Delete all sales rule.
75+
*
76+
* @return void
77+
*/
78+
public function cleanup()
79+
{
80+
$this->deleteAllSalesRule->run();
81+
}
6382
}

0 commit comments

Comments
 (0)