Skip to content

Commit 5d531a6

Browse files
committed
Merge pull request #254 from magento-qmt/MTA-2766
[Mavericks] Web API handlers for products and extended acceptance test suite
2 parents 44f284d + ae50a40 commit 5d531a6

File tree

149 files changed

+1989
-1006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1989
-1006
lines changed

dev/tests/functional/lib/Magento/Mtf/Util/Generate/Factory.php

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
use Magento\Framework\ObjectManagerInterface;
1111

1212
/**
13-
* Class Factory
14-
* Factory classes generator
13+
* Factory classes generator.
1514
*
1615
* @deprecated
1716
*/
@@ -25,38 +24,24 @@ class Factory extends AbstractGenerate
2524
/**
2625
* @constructor
2726
* @param ObjectManagerInterface $objectManager
28-
* @param Factory\Block $block
29-
* @param Factory\Fixture $fixture
30-
* @param Factory\Handler $handler
31-
* @param Factory\Page $page
32-
* @param Factory\Repository $repository
3327
*/
34-
public function __construct(
35-
ObjectManagerInterface $objectManager,
36-
Factory\Block $block,
37-
Factory\Fixture $fixture,
38-
Factory\Handler $handler,
39-
Factory\Page $page,
40-
Factory\Repository $repository
41-
) {
28+
public function __construct(ObjectManagerInterface $objectManager)
29+
{
4230
$this->objectManager = $objectManager;
43-
$this->block = $block;
44-
$this->fixture = $fixture;
45-
$this->handler = $handler;
46-
$this->page = $page;
47-
$this->repository = $repository;
4831
}
4932

5033
/**
51-
* Generate Handlers
34+
* Generate Handlers.
35+
*
36+
* @return \Magento\Framework\App\ResponseInterface
5237
*/
5338
public function launch()
5439
{
55-
$this->block->launch();
56-
$this->fixture->launch();
57-
$this->handler->launch();
58-
$this->page->launch();
59-
$this->repository->launch();
40+
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Block')->launch();
41+
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Fixture')->launch();
42+
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Handler')->launch();
43+
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Page')->launch();
44+
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Repository')->launch();
6045

6146
return $this->objectManager->get('Magento\Framework\App\ResponseInterface');
6247
}

dev/tests/functional/lib/Magento/Mtf/Util/Protocol/CurlTransport/WebapiDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ protected function isValidIntegration()
162162
$this->write($_ENV['app_frontend_url'] . 'rest/V1/modules', [], CurlInterface::GET);
163163
$response = json_decode($this->read(), true);
164164

165-
return !isset($response['message']);
165+
return (null !== $response) && !isset($response['message']);
166166
}
167167

168168
/**

dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOrderBackendTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Sales\Test\TestCase\CreateOrderBackendTest" summary="Checkout with Braintree Credit Card from Admin">
1010
<variation name="CreateOrderBackendTestBraintreeVariation1" summary="Checkout with Braintree Credit Card from Admin (Payment Action = Authorize Only)" ticketId="MAGETWO-46294">
11-
<data name="description" xsi:type="string">Create order in Admin using Fixed shipping method and Braintree payment method</data>
11+
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
1212
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
1313
<data name="customer/dataset" xsi:type="string">default</data>
1414
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
@@ -25,7 +25,6 @@
2525
<data name="configData" xsi:type="string">braintreetwo</data>
2626
<data name="status" xsi:type="string">Processing</data>
2727
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Ship</data>
28-
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
2928
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
3029
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
3130
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
@@ -34,7 +33,7 @@
3433
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" />
3534
</variation>
3635
<variation name="CreateOrderBackendTestBraintreeVariation2" summary="Checkout with Braintree Credit Card from Admin (Payment Action = Authorize and Capture)" ticketId="MAGETWO-38316">
37-
<data name="description" xsi:type="string">Create order in Admin using Fixed shipping method and Braintree payment method</data>
36+
<data name="tag" xsi:type="string">test_type:extended_acceptance_test, test_type:3rd_party_test</data>
3837
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
3938
<data name="customer/dataset" xsi:type="string">default</data>
4039
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
@@ -51,7 +50,6 @@
5150
<data name="configData" xsi:type="string">braintreetwo_sale</data>
5251
<data name="status" xsi:type="string">Processing</data>
5352
<data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Ship</data>
54-
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
5553
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
5654
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
5755
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />

dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="One page check out with Braintree payment method.">
1010
<variation name="OnePageCheckoutBraintreeTestVariation1" summary="Checkout with Braintree Credit Card from Storefront (Payment Action = Authorize)" ticketId="MAGETWO-38313">
11-
<data name="description" xsi:type="string">Create order using Fixed shipping method and Braintree payment method</data>
11+
<data name="tag" xsi:type="string">test_type:extended_acceptance_test, test_type:3rd_party_test</data>
1212
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
1313
<data name="customer/dataset" xsi:type="string">default</data>
1414
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
@@ -24,14 +24,13 @@
2424
<data name="creditCard/dataset" xsi:type="string">visa_braintree</data>
2525
<data name="configData" xsi:type="string">braintreetwo</data>
2626
<data name="status" xsi:type="string">Processing</data>
27-
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
2827
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
2928
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
3029
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
3130
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
3231
</variation>
3332
<variation name="OnePageCheckoutBraintreeTestVariation2" summary="Checkout with Braintree for payment action Authorize and Capture" ticketId="MAGETWO-38420">
34-
<data name="description" xsi:type="string">Create order using Fixed shipping method and Braintree payment method with Payment action = Authorize and Capture</data>
33+
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
3534
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
3635
<data name="customer/dataset" xsi:type="string">default</data>
3736
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
@@ -47,7 +46,6 @@
4746
<data name="creditCard/dataset" xsi:type="string">visa_braintree</data>
4847
<data name="configData" xsi:type="string">braintreetwo_sale</data>
4948
<data name="status" xsi:type="string">Processing</data>
50-
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
5149
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
5250
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
5351
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/Grid.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,26 @@
99
use Magento\Backend\Test\Block\Widget\Grid as GridInterface;
1010

1111
/**
12-
* Class Grid
13-
* 'Add Products to Bundle Option' grid
12+
* 'Add Products to Bundle Option' grid.
1413
*/
1514
class Grid extends GridInterface
1615
{
1716
/**
18-
* Selector for 'Add Selected Products' button
17+
* Selector for 'Add Selected Products' button.
1918
*
2019
* @var string
2120
*/
2221
protected $addProducts = 'button.action-add';
2322

2423
/**
25-
* An element locator which allows to select entities in grid
24+
* An element locator which allows to select entities in grid.
2625
*
2726
* @var string
2827
*/
29-
protected $selectItem = 'tbody tr .col-id';
28+
protected $selectItem = 'tbody tr .col-id input';
3029

3130
/**
32-
* Filters param for grid
31+
* Filters param for grid.
3332
*
3433
* @var array
3534
*/
@@ -43,7 +42,7 @@ class Grid extends GridInterface
4342
];
4443

4544
/**
46-
* Press 'Add Selected Products' button
45+
* Press 'Add Selected Products' button.
4746
*
4847
* @return void
4948
*/

dev/tests/functional/tests/app/Magento/Bundle/Test/Handler/BundleProduct/Curl.php

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
*/
1818
class Curl extends ProductCurl implements BundleProductInterface
1919
{
20-
/**
21-
* Fixture product.
22-
*
23-
* @var BundleProduct
24-
*/
25-
protected $fixture;
26-
2720
/**
2821
* @constructor
2922
* @param DataInterface $configuration
@@ -63,39 +56,80 @@ public function __construct(DataInterface $configuration, EventManagerInterface
6356
'selection_price_type' => [
6457
'Fixed' => 0,
6558
'Percent' => 1,
59+
],
60+
'price_view' => [
61+
'Price Range' => 0,
62+
'As Low as' => 1,
63+
],
64+
'use_config_gift_message_available' => [
65+
'Yes' => 1,
66+
'No' => 0
67+
],
68+
'gift_message_available' => [
69+
'Yes' => 1,
70+
'No' => 0
6671
]
6772
];
6873
}
6974

7075
/**
71-
* Post request for creating bundle product product.
76+
* Prepare POST data for creating product request.
7277
*
73-
* @param FixtureInterface|null $fixture [optional]
78+
* @param FixtureInterface $fixture
7479
* @return array
7580
*/
76-
public function persist(FixtureInterface $fixture = null)
81+
public function prepareData(FixtureInterface $fixture)
7782
{
78-
$this->fixture = $fixture;
79-
return parent::persist($fixture);
83+
$this->fields = parent::prepareData($fixture);
84+
85+
$this->prepareBundleItems();
86+
$this->fields = $this->replaceMappingData($this->fields);
87+
88+
return $this->fields;
8089
}
8190

8291
/**
83-
* Prepare POST data for creating product request.
92+
* Preparation of "Product Details" tab data.
8493
*
85-
* @param FixtureInterface $fixture
86-
* @param string|null $prefix [optional]
87-
* @return array
94+
* @return void
8895
*/
89-
protected function prepareData(FixtureInterface $fixture, $prefix = null)
96+
protected function prepareProductDetails()
9097
{
91-
$data = parent::prepareData($fixture, null);
98+
parent::prepareProductDetails();
9299

100+
if (!isset($this->fields['product']['price_type'])) {
101+
$this->fields['product']['price_type'] = 'Dynamic';
102+
}
103+
}
104+
105+
/**
106+
* Preparation of "Advanced Pricing" tab data.
107+
*
108+
* @return void
109+
*/
110+
protected function prepareAdvancedPricing()
111+
{
112+
parent::prepareAdvancedPricing();
113+
114+
if (!isset($this->fields['product']['price_view'])) {
115+
$this->fields['product']['price_view'] = 'Price Range';
116+
}
117+
}
118+
119+
/**
120+
* Preparation of selections data.
121+
*
122+
* @return void
123+
*/
124+
protected function prepareBundleItems()
125+
{
93126
$selections = [];
94127
$bundleSelections = [];
95-
if (!empty($data['bundle_selections'])) {
96-
$selections = $data['bundle_selections'];
128+
129+
if (!empty($this->fields['product']['bundle_selections'])) {
130+
$selections = $this->fields['product']['bundle_selections'];
97131
$products = $selections['products'];
98-
unset($data['selections'], $selections['products']);
132+
unset($this->fields['product']['selections'], $selections['products']);
99133

100134
foreach ($selections['bundle_options'] as $key => &$option) {
101135
$option['delete'] = '';
@@ -111,11 +145,9 @@ protected function prepareData(FixtureInterface $fixture, $prefix = null)
111145
unset($option['assigned_products']);
112146
}
113147
}
114-
$data = $prefix ? [$prefix => $data] : $data;
115-
$data = array_merge($data, $selections);
116-
$data['bundle_selections'] = $bundleSelections;
117148

118-
return $this->replaceMappingData($data);
149+
$this->fields = array_merge($this->fields, $selections);
150+
$this->fields['bundle_selections'] = $bundleSelections;
119151
}
120152

121153
/**

0 commit comments

Comments
 (0)