Skip to content

Commit

Permalink
Merge branch 'develop' of github.corp.magento.com:magento2/magento2ce…
Browse files Browse the repository at this point in the history
… into bugs
  • Loading branch information
ishakhsuvarov committed Dec 23, 2015
2 parents 915d10e + 5d531a6 commit 0822de9
Show file tree
Hide file tree
Showing 149 changed files with 1,989 additions and 1,006 deletions.
37 changes: 11 additions & 26 deletions dev/tests/functional/lib/Magento/Mtf/Util/Generate/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
use Magento\Framework\ObjectManagerInterface;

/**
* Class Factory
* Factory classes generator
* Factory classes generator.
*
* @deprecated
*/
Expand All @@ -25,38 +24,24 @@ class Factory extends AbstractGenerate
/**
* @constructor
* @param ObjectManagerInterface $objectManager
* @param Factory\Block $block
* @param Factory\Fixture $fixture
* @param Factory\Handler $handler
* @param Factory\Page $page
* @param Factory\Repository $repository
*/
public function __construct(
ObjectManagerInterface $objectManager,
Factory\Block $block,
Factory\Fixture $fixture,
Factory\Handler $handler,
Factory\Page $page,
Factory\Repository $repository
) {
public function __construct(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
$this->block = $block;
$this->fixture = $fixture;
$this->handler = $handler;
$this->page = $page;
$this->repository = $repository;
}

/**
* Generate Handlers
* Generate Handlers.
*
* @return \Magento\Framework\App\ResponseInterface
*/
public function launch()
{
$this->block->launch();
$this->fixture->launch();
$this->handler->launch();
$this->page->launch();
$this->repository->launch();
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Block')->launch();
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Fixture')->launch();
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Handler')->launch();
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Page')->launch();
$this->objectManager->create('Magento\Mtf\Util\Generate\Factory\Repository')->launch();

return $this->objectManager->get('Magento\Framework\App\ResponseInterface');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function isValidIntegration()
$this->write($_ENV['app_frontend_url'] . 'rest/V1/modules', [], CurlInterface::GET);
$response = json_decode($this->read(), true);

return !isset($response['message']);
return (null !== $response) && !isset($response['message']);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Sales\Test\TestCase\CreateOrderBackendTest" summary="Checkout with Braintree Credit Card from Admin">
<variation name="CreateOrderBackendTestBraintreeVariation1" summary="Checkout with Braintree Credit Card from Admin (Payment Action = Authorize Only)" ticketId="MAGETWO-46294">
<data name="description" xsi:type="string">Create order in Admin using Fixed shipping method and Braintree payment method</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="customer/dataset" xsi:type="string">default</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
Expand All @@ -25,7 +25,6 @@
<data name="configData" xsi:type="string">braintreetwo</data>
<data name="status" xsi:type="string">Processing</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Ship</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
Expand All @@ -34,7 +33,7 @@
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGridOnFrontend" />
</variation>
<variation name="CreateOrderBackendTestBraintreeVariation2" summary="Checkout with Braintree Credit Card from Admin (Payment Action = Authorize and Capture)" ticketId="MAGETWO-38316">
<data name="description" xsi:type="string">Create order in Admin using Fixed shipping method and Braintree payment method</data>
<data name="tag" xsi:type="string">test_type:extended_acceptance_test, test_type:3rd_party_test</data>
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="customer/dataset" xsi:type="string">default</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
Expand All @@ -51,7 +50,6 @@
<data name="configData" xsi:type="string">braintreetwo_sale</data>
<data name="status" xsi:type="string">Processing</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Hold, Ship</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
<testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="One page check out with Braintree payment method.">
<variation name="OnePageCheckoutBraintreeTestVariation1" summary="Checkout with Braintree Credit Card from Storefront (Payment Action = Authorize)" ticketId="MAGETWO-38313">
<data name="description" xsi:type="string">Create order using Fixed shipping method and Braintree payment method</data>
<data name="tag" xsi:type="string">test_type:extended_acceptance_test, test_type:3rd_party_test</data>
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="customer/dataset" xsi:type="string">default</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
Expand All @@ -24,14 +24,13 @@
<data name="creditCard/dataset" xsi:type="string">visa_braintree</data>
<data name="configData" xsi:type="string">braintreetwo</data>
<data name="status" xsi:type="string">Processing</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
</variation>
<variation name="OnePageCheckoutBraintreeTestVariation2" summary="Checkout with Braintree for payment action Authorize and Capture" ticketId="MAGETWO-38420">
<data name="description" xsi:type="string">Create order using Fixed shipping method and Braintree payment method with Payment action = Authorize and Capture</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
<data name="customer/dataset" xsi:type="string">default</data>
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
Expand All @@ -47,7 +46,6 @@
<data name="creditCard/dataset" xsi:type="string">visa_braintree</data>
<data name="configData" xsi:type="string">braintreetwo_sale</data>
<data name="status" xsi:type="string">Processing</data>
<data name="tag" xsi:type="string">test_type:3rd_party_test</data>
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,26 @@
use Magento\Backend\Test\Block\Widget\Grid as GridInterface;

/**
* Class Grid
* 'Add Products to Bundle Option' grid
* 'Add Products to Bundle Option' grid.
*/
class Grid extends GridInterface
{
/**
* Selector for 'Add Selected Products' button
* Selector for 'Add Selected Products' button.
*
* @var string
*/
protected $addProducts = 'button.action-add';

/**
* An element locator which allows to select entities in grid
* An element locator which allows to select entities in grid.
*
* @var string
*/
protected $selectItem = 'tbody tr .col-id';
protected $selectItem = 'tbody tr .col-id input';

/**
* Filters param for grid
* Filters param for grid.
*
* @var array
*/
Expand All @@ -43,7 +42,7 @@ class Grid extends GridInterface
];

/**
* Press 'Add Selected Products' button
* Press 'Add Selected Products' button.
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
*/
class Curl extends ProductCurl implements BundleProductInterface
{
/**
* Fixture product.
*
* @var BundleProduct
*/
protected $fixture;

/**
* @constructor
* @param DataInterface $configuration
Expand Down Expand Up @@ -63,39 +56,80 @@ public function __construct(DataInterface $configuration, EventManagerInterface
'selection_price_type' => [
'Fixed' => 0,
'Percent' => 1,
],
'price_view' => [
'Price Range' => 0,
'As Low as' => 1,
],
'use_config_gift_message_available' => [
'Yes' => 1,
'No' => 0
],
'gift_message_available' => [
'Yes' => 1,
'No' => 0
]
];
}

/**
* Post request for creating bundle product product.
* Prepare POST data for creating product request.
*
* @param FixtureInterface|null $fixture [optional]
* @param FixtureInterface $fixture
* @return array
*/
public function persist(FixtureInterface $fixture = null)
public function prepareData(FixtureInterface $fixture)
{
$this->fixture = $fixture;
return parent::persist($fixture);
$this->fields = parent::prepareData($fixture);

$this->prepareBundleItems();
$this->fields = $this->replaceMappingData($this->fields);

return $this->fields;
}

/**
* Prepare POST data for creating product request.
* Preparation of "Product Details" tab data.
*
* @param FixtureInterface $fixture
* @param string|null $prefix [optional]
* @return array
* @return void
*/
protected function prepareData(FixtureInterface $fixture, $prefix = null)
protected function prepareProductDetails()
{
$data = parent::prepareData($fixture, null);
parent::prepareProductDetails();

if (!isset($this->fields['product']['price_type'])) {
$this->fields['product']['price_type'] = 'Dynamic';
}
}

/**
* Preparation of "Advanced Pricing" tab data.
*
* @return void
*/
protected function prepareAdvancedPricing()
{
parent::prepareAdvancedPricing();

if (!isset($this->fields['product']['price_view'])) {
$this->fields['product']['price_view'] = 'Price Range';
}
}

/**
* Preparation of selections data.
*
* @return void
*/
protected function prepareBundleItems()
{
$selections = [];
$bundleSelections = [];
if (!empty($data['bundle_selections'])) {
$selections = $data['bundle_selections'];

if (!empty($this->fields['product']['bundle_selections'])) {
$selections = $this->fields['product']['bundle_selections'];
$products = $selections['products'];
unset($data['selections'], $selections['products']);
unset($this->fields['product']['selections'], $selections['products']);

foreach ($selections['bundle_options'] as $key => &$option) {
$option['delete'] = '';
Expand All @@ -111,11 +145,9 @@ protected function prepareData(FixtureInterface $fixture, $prefix = null)
unset($option['assigned_products']);
}
}
$data = $prefix ? [$prefix => $data] : $data;
$data = array_merge($data, $selections);
$data['bundle_selections'] = $bundleSelections;

return $this->replaceMappingData($data);
$this->fields = array_merge($this->fields, $selections);
$this->fields['bundle_selections'] = $bundleSelections;
}

/**
Expand Down
Loading

0 comments on commit 0822de9

Please sign in to comment.