Skip to content

Commit f94092f

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'mainline/develop' into literal_classname_to_namespace
2 parents 66763b6 + 2db9e0f commit f94092f

File tree

118 files changed

+2421
-673
lines changed

Some content is hidden

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

118 files changed

+2421
-673
lines changed

dev/tests/functional/.htaccess.sample

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
##############################################
2+
## Allow access to command.php and website.php
3+
<FilesMatch "command.php|website.php">
4+
order allow,deny
5+
allow from all
6+
</FilesMatch>

dev/tests/functional/composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc43",
4-
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
3+
"magento/mtf": "1.0.0-rc44",
4+
"php": "~5.6.0|7.0.2|~7.0.6",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2"
77
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command;
8+
9+
use Magento\Mtf\Util\Protocol\CurlInterface;
10+
use Magento\Mtf\ObjectManager;
11+
use Magento\Mtf\Util\Protocol\CurlTransport;
12+
13+
/**
14+
* Perform bin/magento commands from command line for functional tests executions.
15+
*/
16+
class Cli
17+
{
18+
/**
19+
* Url to command.php.
20+
*/
21+
const URL = 'dev/tests/functional/utils/command.php';
22+
23+
/**
24+
* Curl transport protocol.
25+
*
26+
* @var CurlTransport
27+
*/
28+
private $transport;
29+
30+
/**
31+
* @constructor
32+
* @param CurlTransport $transport
33+
*/
34+
public function __construct(CurlTransport $transport)
35+
{
36+
$this->transport = $transport;
37+
}
38+
39+
/**
40+
* Run command.
41+
*
42+
* @param string $command
43+
* @param array $options [optional]
44+
* @return void
45+
*/
46+
protected function execute($command, $options = [])
47+
{
48+
$curl = $this->transport;
49+
$curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET);
50+
$curl->close();
51+
}
52+
53+
/**
54+
* Prepare url.
55+
*
56+
* @param string $command
57+
* @param array $options
58+
* @return string
59+
*/
60+
private function prepareUrl($command, array $options)
61+
{
62+
$command .= ' ' . implode(' ', $options);
63+
return $_ENV['app_frontend_url'] . Cli::URL . '?command=' . urldecode($command);
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command\Cli;
8+
9+
use Magento\Mtf\Util\Command\Cli;
10+
11+
/**
12+
* Handle cron for tests executions.
13+
*/
14+
class Cron extends Cli
15+
{
16+
/**
17+
* Parameter for cron run command.
18+
*/
19+
const PARAM_CRON_RUN = 'cron:run';
20+
21+
/**
22+
* Run cron.
23+
*
24+
* @return void
25+
*/
26+
public function run()
27+
{
28+
parent::execute(Cron::PARAM_CRON_RUN);
29+
sleep(60); // According to Magento 2 documentation cron job running takes 600 ms
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Mtf\Util\Command;
8+
9+
use Magento\Mtf\Util\Protocol\CurlInterface;
10+
use Magento\Mtf\Util\Protocol\CurlTransport;
11+
12+
/**
13+
* Perform Website folder creation for functional tests executions.
14+
*/
15+
class Website
16+
{
17+
/**
18+
* Url to website.php.
19+
*/
20+
const URL = 'dev/tests/functional/utils/website.php';
21+
22+
/**
23+
* Curl transport protocol.
24+
*
25+
* @var CurlTransport
26+
*/
27+
private $transport;
28+
29+
/**
30+
* @constructor
31+
* @param CurlTransport $transport
32+
*/
33+
public function __construct(CurlTransport $transport)
34+
{
35+
$this->transport = $transport;
36+
}
37+
38+
/**
39+
* Creates Website folder in root directory.
40+
*
41+
* @param string $websiteCode
42+
* @throws \Exception
43+
*/
44+
public function create($websiteCode)
45+
{
46+
$curl = $this->transport;
47+
$curl->addOption(CURLOPT_HEADER, 1);
48+
$curl->write($this->prepareUrl($websiteCode), [], CurlInterface::GET);
49+
$curl->read();
50+
$curl->close();
51+
}
52+
53+
/**
54+
* Prepare url.
55+
*
56+
* @param string $websiteCode
57+
* @return string
58+
*/
59+
private function prepareUrl($websiteCode)
60+
{
61+
return $_ENV['app_frontend_url'] . Website::URL . '?website_code=' . urldecode($websiteCode);
62+
}
63+
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ protected function authorize()
7676
];
7777
$this->transport->write($url, $data, CurlInterface::POST);
7878
$response = $this->read();
79-
if (strpos($response, 'page-login')) {
79+
if (strpos($response, 'login-form')) {
8080
throw new \Exception(
8181
'Admin user cannot be logged in by curl handler!'
8282
);

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

+1-1
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 Authorize.Net payment method.">
1010
<variation name="OnePageCheckoutAuthorizenetTestVariation1" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832">
11-
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar</data>
11+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
1212
<data name="customer/dataset" xsi:type="string">default</data>
1313
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
1414
<data name="checkoutMethod" xsi:type="string">guest</data>

dev/tests/functional/tests/app/Magento/Backend/Test/Handler/Conditions.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ private function convertSingleCondition($condition)
167167
$condition = $this->parseCondition($condition);
168168
extract($condition);
169169

170-
$typeParam = $this->getTypeParam($type);
170+
if (isset($param)) {
171+
$typeParam = $this->getTypeParam($param);
172+
$typeParam['attribute'] = $type;
173+
} else {
174+
$typeParam = $this->getTypeParam($type);
175+
}
171176
if (empty($typeParam)) {
172177
throw new \Exception("Can't find type param \"{$type}\".");
173178
}
@@ -258,10 +263,18 @@ private function parseCondition($condition)
258263
foreach ($match[1] as $key => $value) {
259264
$match[1][$key] = rtrim($value, '|');
260265
}
266+
$param = $match[1][0];
267+
$type = array_shift($match[1]);
268+
if (count($match[1]) == 3) {
269+
$type = array_shift($match[1]);
270+
} else {
271+
$param = null;
272+
}
261273

262274
return [
263-
'type' => array_shift($match[1]),
275+
'type' => $type,
264276
'rules' => array_values($match[1]),
277+
'param' => $param
265278
];
266279
}
267280
}

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

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
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="OnePageCheckoutBraintree3dSecureNotTriggeredThresholdTestVariation1" summary="Registered Checkout with Braintree Credit Card from Storefront with 3D Secure verification not triggered due to Threshold Amount" ticketId="MAGETWO-46763">
11-
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
11+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
12+
<data name="products/1" xsi:type="string">configurableProduct::with_one_option</data>
13+
<data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data>
1214
<data name="customer/dataset" xsi:type="string">default</data>
1315
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
1416
<data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
@@ -29,7 +31,9 @@
2931
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
3032
</variation>
3133
<variation name="OnePageCheckoutBraintree3dSecureNotTriggeredSpecificCountryTestVariation2" summary="Guest Checkout with Braintree Credit Card from Storefront with 3D Secure verification not triggered due to selected Specific Country" ticketId="MAGETWO-46488">
32-
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
34+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
35+
<data name="products/1" xsi:type="string">configurableProduct::with_one_option</data>
36+
<data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data>
3337
<data name="customer/dataset" xsi:type="string">default</data>
3438
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
3539
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
@@ -50,7 +54,9 @@
5054
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
5155
</variation>
5256
<variation name="OnePageCheckoutBraintreeTestVariation3" summary="Checkout with Braintree Credit Card from Storefront (Payment Action = Authorize)" ticketId="MAGETWO-38313">
53-
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
57+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
58+
<data name="products/1" xsi:type="string">configurableProduct::with_one_option</data>
59+
<data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data>
5460
<data name="customer/dataset" xsi:type="string">default</data>
5561
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
5662
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>
@@ -72,7 +78,9 @@
7278
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
7379
</variation>
7480
<variation name="OnePageCheckoutBraintreeTestVariation4" summary="Checkout with Braintree for payment action Authorize and Capture" ticketId="MAGETWO-38420">
75-
<data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data>
81+
<data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
82+
<data name="products/1" xsi:type="string">configurableProduct::with_one_option</data>
83+
<data name="products/2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data>
7684
<data name="customer/dataset" xsi:type="string">default</data>
7785
<data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
7886
<data name="shippingAddress/dataset" xsi:type="string">US_address_1</data>

dev/tests/functional/tests/app/Magento/Bundle/Test/Fixture/BundleProduct.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<field name="affect_bundle_product_selection" />
9191
<field name="stock_data" group="advanced-inventory" />
9292
<field name="category_id" group="product-details" />
93-
<field name="website_ids" group="websites" />
93+
<field name="website_ids" group="websites" source="Magento\Catalog\Test\Fixture\Product\WebsiteIds" />
9494
<field name="cross_sell_products" group="related" source="Magento\Catalog\Test\Fixture\Product\UpSellProducts" />
9595
<field name="up_sell_products" group="related" source="Magento\Catalog\Test\Fixture\Product\CrossSellProducts" />
9696
<field name="related_products" group="related" source="Magento\Catalog\Test\Fixture\Product\RelatedProducts" />

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

+21-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
<item name="dataset" xsi:type="string">bundle_dynamic_with_category</item>
1818
</field>
1919
<field name="website_ids" xsi:type="array">
20-
<item name="0" xsi:type="string">Main Website</item>
20+
<item name="0" xsi:type="array">
21+
<item name="dataset" xsi:type="string">default</item>
22+
</item>
2123
</field>
2224
<field name="bundle_selections" xsi:type="array">
2325
<item name="dataset" xsi:type="string">default_dynamic</item>
@@ -44,7 +46,9 @@
4446
<item name="dataset" xsi:type="string">taxable_goods</item>
4547
</field>
4648
<field name="website_ids" xsi:type="array">
47-
<item name="0" xsi:type="string">Main Website</item>
49+
<item name="0" xsi:type="array">
50+
<item name="dataset" xsi:type="string">default</item>
51+
</item>
4852
</field>
4953
<field name="stock_data" xsi:type="array">
5054
<item name="manage_stock" xsi:type="string">Yes</item>
@@ -83,7 +87,9 @@
8387
<field name="status" xsi:type="string">Yes</field>
8488
<field name="shipment_type" xsi:type="string">Together</field>
8589
<field name="website_ids" xsi:type="array">
86-
<item name="0" xsi:type="string">Main Website</item>
90+
<item name="0" xsi:type="array">
91+
<item name="dataset" xsi:type="string">default</item>
92+
</item>
8793
</field>
8894
<field name="stock_data" xsi:type="array">
8995
<item name="manage_stock" xsi:type="string">Yes</item>
@@ -117,7 +123,9 @@
117123
<field name="weight" xsi:type="string">1</field>
118124
<field name="weight_type" xsi:type="string">No</field>
119125
<field name="website_ids" xsi:type="array">
120-
<item name="0" xsi:type="string">Main Website</item>
126+
<item name="0" xsi:type="array">
127+
<item name="dataset" xsi:type="string">default</item>
128+
</item>
121129
</field>
122130
<field name="category_ids" xsi:type="array">
123131
<item name="dataset" xsi:type="string">default_subcategory</item>
@@ -137,7 +145,9 @@
137145
<item name="dataset" xsi:type="string">bundle_dynamic_with_category</item>
138146
</field>
139147
<field name="website_ids" xsi:type="array">
140-
<item name="0" xsi:type="string">Main Website</item>
148+
<item name="0" xsi:type="array">
149+
<item name="dataset" xsi:type="string">default</item>
150+
</item>
141151
</field>
142152
<field name="category_ids" xsi:type="array">
143153
<item name="dataset" xsi:type="string">default_subcategory</item>
@@ -162,7 +172,9 @@
162172
<field name="weight" xsi:type="string">1</field>
163173
<field name="weight_type" xsi:type="string">No</field>
164174
<field name="website_ids" xsi:type="array">
165-
<item name="0" xsi:type="string">Main Website</item>
175+
<item name="0" xsi:type="array">
176+
<item name="dataset" xsi:type="string">default</item>
177+
</item>
166178
</field>
167179
<field name="shipment_type" xsi:type="string">Separately</field>
168180
<field name="bundle_selections" xsi:type="array">
@@ -193,7 +205,9 @@
193205
<field name="status" xsi:type="string">Yes</field>
194206
<field name="shipment_type" xsi:type="string">Together</field>
195207
<field name="website_ids" xsi:type="array">
196-
<item name="0" xsi:type="string">Main Website</item>
208+
<item name="0" xsi:type="array">
209+
<item name="dataset" xsi:type="string">default</item>
210+
</item>
197211
</field>
198212
<field name="stock_data" xsi:type="array">
199213
<item name="manage_stock" xsi:type="string">Yes</item>

dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml

+1-1
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\DeleteProductFromMiniShoppingCartTest" summary="Delete Bundle Product from Mini Shopping Cart" ticketId="MAGETWO-29104">
1010
<variation name="DeleteBundleProductFromMiniShoppingCartTestVariation">
11-
<data name="products" xsi:type="string">bundleProduct::default</data>
11+
<data name="products/0" xsi:type="string">bundleProduct::default</data>
1212
<data name="deletedProductIndex" xsi:type="string">0</data>
1313
<constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" />
1414
</variation>

0 commit comments

Comments
 (0)