Skip to content

Commit fa12866

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-54680
2 parents 03eb42a + e6363a8 commit fa12866

File tree

22 files changed

+598
-66
lines changed

22 files changed

+598
-66
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,4 +567,13 @@ protected function getProductEntityLinkField()
567567
}
568568
return $this->productEntityLinkField;
569569
}
570+
571+
/**
572+
* Clean cached values
573+
*/
574+
public function __destruct()
575+
{
576+
self::$attributeCodeToId = [];
577+
self::$commonAttributesCache = [];
578+
}
570579
}

dev/tests/functional/bootstrap.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111

1212
require_once __DIR__ . '/../../../app/bootstrap.php';
1313
restore_error_handler();
14-
require_once __DIR__ . '/vendor/autoload.php';
14+
$vendorAutoload = __DIR__ . '/vendor/autoload.php';
15+
16+
if (isset($composerAutoloader)) {
17+
/** var $mtfComposerAutoload \Composer\Autoload\ClassLoader */
18+
$mtfComposerAutoload = include $vendorAutoload;
19+
$composerAutoloader->addClassMap($mtfComposerAutoload->getClassMap());
20+
} else {
21+
$composerAutoloader = include $vendorAutoload;
22+
}
1523

1624
setCustomErrorHandler();
1725

dev/tests/functional/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc47",
3+
"magento/mtf": "1.0.0-rc48",
44
"php": "~5.6.0|7.0.2|~7.0.6",
5-
"phpunit/phpunit": "4.1.0",
5+
"phpunit/phpunit": "~4.8.0|~5.5.0",
66
"phpunit/phpunit-selenium": ">=1.2"
77
},
88
"suggest": {

dev/tests/functional/credentials.xml.dist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,36 @@
2727
<field replace="carriers_dhl_id_eu" value="" />
2828
<field replace="carriers_dhl_password_eu" value="" />
2929
<field replace="carriers_dhl_account_eu" value="" />
30+
31+
<field path="payment/authorizenet_directpost/login" value="" />
32+
<field path="payment/authorizenet_directpost/trans_key" value="" />
33+
<field path="payment/authorizenet_directpost/trans_md5" value="" />
34+
35+
<field path="payment/braintree_section/braintree/braintree_advanced/merchant_account_id" value="" />
36+
<field path="payment/braintree_section/braintree/braintree_required/merchant_id" value="" />
37+
<field path="payment/braintree_section/braintree/braintree_required/public_key" value="" />
38+
<field path="payment/braintree_section/braintree/braintree_required/private_key" value="" />
39+
40+
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/business_account" value="" />
41+
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_username" value="" />
42+
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_password" value="" />
43+
<field path="payment/paypal_group_all_in_one/wpp_usuk/wpp_required_settings/wpp_and_express_checkout/api_signature" value="" />
44+
<field path="payment/paypal_express/merchant_id" value="" />
45+
46+
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/business_account" value="" />
47+
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/partner" value="" />
48+
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/user" value="" />
49+
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/pwd" value="" />
50+
<field path="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/paypal_payflow_api_settings/vendor" value="" />
51+
52+
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/business_account" value="" />
53+
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_username" value="" />
54+
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_password" value="" />
55+
<field path="payment/paypal_alternative_payment_methods/express_checkout_us/express_checkout_required/express_checkout_required_express_checkout/api_signature" value="" />
56+
57+
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/business_account" value="" />
58+
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/partner" value="" />
59+
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/user" value="" />
60+
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/pwd" value="" />
61+
<field path="payment/paypal_payment_gateways/payflow_link_us/payflow_link_required/payflow_link_payflow_link/vendor" value="" />
3062
</replace>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Client\Element;
8+
9+
use Magento\Mtf\Client\Locator;
10+
11+
/**
12+
* Class provides ability to work with page element radio button.
13+
*/
14+
class RadiobuttonElement extends SimpleElement
15+
{
16+
/**
17+
* Label for radio button selector.
18+
*
19+
* @var string
20+
*/
21+
protected $labelSelector = './..//label[contains(., "%s")]';
22+
23+
/**
24+
* Selector for selected label.
25+
*
26+
* @var string
27+
*/
28+
protected $selectedLabelSelector = 'input[type=radio]:checked + label';
29+
30+
/**
31+
* Get value of the required element.
32+
*
33+
* @return string
34+
*/
35+
public function getValue()
36+
{
37+
$this->eventManager->dispatchEvent(['get_value'], [$this->getAbsoluteSelector()]);
38+
39+
return $this->find($this->selectedLabelSelector)->getText();
40+
}
41+
42+
/**
43+
* Select radio button based on label value.
44+
*
45+
* @param string $value
46+
* @return void
47+
*/
48+
public function setValue($value)
49+
{
50+
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
51+
52+
$radioButtonLabel = $this->find(sprintf($this->labelSelector, $value), Locator::SELECTOR_XPATH);
53+
if (!$this->isSelected()) {
54+
$radioButtonLabel->click();
55+
}
56+
}
57+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Constraint;
8+
9+
use Magento\Catalog\Test\Constraint\AssertProductInCart;
10+
use Magento\Checkout\Test\Page\CheckoutCart;
11+
use Magento\Mtf\Fixture\FixtureInterface;
12+
13+
/**
14+
* Assertion that bundle product is correctly displayed in cart.
15+
*/
16+
class AssertBundleProductInCart extends AssertProductInCart
17+
{
18+
/**
19+
* Count prices.
20+
*
21+
* @param FixtureInterface $product
22+
* @param CheckoutCart $checkoutCart
23+
* @return void
24+
*/
25+
protected function countPrices(FixtureInterface $product, CheckoutCart $checkoutCart)
26+
{
27+
parent::countPrices($product, $checkoutCart);
28+
$this->countSubItemPrice($product);
29+
}
30+
31+
/**
32+
* Count subItem price.
33+
*
34+
* @param FixtureInterface $product
35+
* @return void
36+
*/
37+
private function countSubItemPrice(FixtureInterface $product)
38+
{
39+
$checkoutData = $product->getCheckoutData();
40+
if (isset($checkoutData['cartItem']['subItemPrice'])) {
41+
$this->fixtureActualPrice += $checkoutData["cartItem"]["subItemPrice"];
42+
}
43+
}
44+
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleProductPage.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,39 @@ protected function verifyPrice()
4646

4747
return empty($errors) ? null : implode("\n", $errors);
4848
}
49+
50+
/**
51+
* Verify product special price is displayed on product page(front-end).
52+
*
53+
* @return string|null
54+
*/
55+
protected function verifySpecialPrice()
56+
{
57+
if (!$this->product->hasData('special_price')) {
58+
return null;
59+
}
60+
61+
$priceBlock = $this->productView->getPriceBlock();
62+
63+
if (!$priceBlock->isVisible()) {
64+
return "Price block for '{$this->product->getName()}' product' is not visible.";
65+
}
66+
67+
if (!$priceBlock->isOldPriceVisible()) {
68+
return 'Bundle special price is not set.';
69+
}
70+
71+
$regularPrice = $priceBlock->getOldPrice();
72+
$priceData = $this->product->getDataFieldConfig('price')['source']->getPriceData();
73+
74+
if (!isset($priceData['regular_from'])) {
75+
return 'Regular from price not set.';
76+
}
77+
78+
if ($priceData['regular_from'] != $regularPrice) {
79+
return 'Bundle regular price on product view page is not correct.';
80+
}
81+
82+
return null;
83+
}
4984
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/BundleSelections.xml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
<field name="products" xsi:type="array">
151151
<item name="0" xsi:type="array">
152152
<item name="0" xsi:type="string">catalogProductSimple::default</item>
153-
<item name="1" xsi:type="string">catalogProductSimple::product_100_dollar</item>
153+
<item name="1" xsi:type="string">catalogProductSimple::product_10_dollar</item>
154154
</item>
155155
</field>
156156
</dataset>
@@ -604,5 +604,66 @@
604604
</item>
605605
</field>
606606
</dataset>
607+
608+
<dataset name="dynamic_with_two_required_options_assigned_products_with_special_price">
609+
<field name="bundle_options" xsi:type="array">
610+
<item name="0" xsi:type="array">
611+
<item name="title" xsi:type="string">Drop-down Option</item>
612+
<item name="type" xsi:type="string">Drop-down</item>
613+
<item name="required" xsi:type="string">Yes</item>
614+
<item name="assigned_products" xsi:type="array">
615+
<item name="0" xsi:type="array">
616+
<item name="search_data" xsi:type="array">
617+
<item name="name" xsi:type="string">%product_name%</item>
618+
</item>
619+
<item name="data" xsi:type="array">
620+
<item name="selection_qty" xsi:type="string">1</item>
621+
</item>
622+
</item>
623+
<item name="1" xsi:type="array">
624+
<item name="search_data" xsi:type="array">
625+
<item name="name" xsi:type="string">%product_name%</item>
626+
</item>
627+
<item name="data" xsi:type="array">
628+
<item name="selection_qty" xsi:type="string">1</item>
629+
</item>
630+
</item>
631+
</item>
632+
</item>
633+
<item name="1" xsi:type="array">
634+
<item name="title" xsi:type="string">Drop-down Option</item>
635+
<item name="type" xsi:type="string">Drop-down</item>
636+
<item name="required" xsi:type="string">Yes</item>
637+
<item name="assigned_products" xsi:type="array">
638+
<item name="0" xsi:type="array">
639+
<item name="search_data" xsi:type="array">
640+
<item name="name" xsi:type="string">%product_name%</item>
641+
</item>
642+
<item name="data" xsi:type="array">
643+
<item name="selection_qty" xsi:type="string">1</item>
644+
</item>
645+
</item>
646+
<item name="1" xsi:type="array">
647+
<item name="search_data" xsi:type="array">
648+
<item name="name" xsi:type="string">%product_name%</item>
649+
</item>
650+
<item name="data" xsi:type="array">
651+
<item name="selection_qty" xsi:type="string">1</item>
652+
</item>
653+
</item>
654+
</item>
655+
</item>
656+
</field>
657+
<field name="products" xsi:type="array">
658+
<item name="0" xsi:type="array">
659+
<item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
660+
<item name="1" xsi:type="string">catalogProductSimple::product_with_special_price</item>
661+
</item>
662+
<item name="1" xsi:type="array">
663+
<item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
664+
<item name="1" xsi:type="string">catalogProductSimple::product_with_special_price</item>
665+
</item>
666+
</field>
667+
</dataset>
607668
</repository>
608669
</config>

dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/CheckoutData.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,36 @@
206206
</field>
207207
</dataset>
208208

209+
<dataset name="bundle_with_custom_options_3">
210+
<field name="options" xsi:type="array">
211+
<item name="bundle_options" xsi:type="array">
212+
<item name="0" xsi:type="array">
213+
<item name="title" xsi:type="string">Drop-down Option</item>
214+
<item name="type" xsi:type="string">Drop-down</item>
215+
<item name="value" xsi:type="array">
216+
<item name="name" xsi:type="string">product_10_dollar</item>
217+
</item>
218+
</item>
219+
</item>
220+
<item name="custom_options" xsi:type="array">
221+
<item name="0" xsi:type="array">
222+
<item name="title" xsi:type="string">attribute_key_0</item>
223+
<item name="value" xsi:type="string">option_key_0</item>
224+
</item>
225+
<item name="1" xsi:type="array">
226+
<item name="title" xsi:type="string">attribute_key_1</item>
227+
<item name="value" xsi:type="string">option_key_0</item>
228+
</item>
229+
</item>
230+
</field>
231+
<field name="cartItem" xsi:type="array">
232+
<item name="price" xsi:type="string">100</item>
233+
<item name="qty" xsi:type="string">1</item>
234+
<item name="subtotal" xsi:type="string">100</item>
235+
<item name="subItemPrice" xsi:type="string">10</item>
236+
</field>
237+
</dataset>
238+
209239
<dataset name="bundle_all_types_bundle_fixed_and_custom_options">
210240
<field name="options" xsi:type="array">
211241
<item name="bundle_options" xsi:type="array">

dev/tests/functional/tests/app/Magento/Bundle/Test/Repository/BundleProduct/Price.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@
7878
<field name="cart_price" xsi:type="string">756.00</field>
7979
</dataset>
8080

81+
<dataset name="fixed-51">
82+
<field name="price_from" xsi:type="string">51.00</field>
83+
<field name="price_to" xsi:type="string">52.00</field>
84+
<field name="regular_from" xsi:type="string">135.00</field>
85+
</dataset>
86+
87+
<dataset name="fixed-756-custom-options">
88+
<field name="price_from" xsi:type="string">785.00</field>
89+
<field name="price_to" xsi:type="string">786.00</field>
90+
<field name="cart_price" xsi:type="string">786.00</field>
91+
</dataset>
92+
8193
<dataset name="bundle_fixed_with_category">
8294
<field name="price_from" xsi:type="string">130.00</field>
8395
<field name="price_to" xsi:type="string">144.00</field>
@@ -94,6 +106,12 @@
94106
<field name="price_from" xsi:type="string">8.00</field>
95107
<field name="price_to" xsi:type="string">20.00</field>
96108
<field name="cart_price" xsi:type="string">80.00</field>
109+
<field name="regular_from" xsi:type="string">40.00</field>
110+
</dataset>
111+
112+
<dataset name="dynamic-18">
113+
<field name="price_from" xsi:type="string">18.00</field>
114+
<field name="price_to" xsi:type="string">20.00</field>
97115
</dataset>
98116

99117
<dataset name="dynamic-32">

0 commit comments

Comments
 (0)