Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Commit 4c830d4

Browse files
authored
Merge pull request #5133 from magento-tsg/2.3-develop-com-pr9
[TSG-Commerce] Tests for 2.3 (pr9) (2.3-develop)
2 parents 46d3839 + 1b9cf83 commit 4c830d4

File tree

33 files changed

+2801
-91
lines changed

33 files changed

+2801
-91
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestFramework\Catalog\Block\Product\View\Options;
9+
10+
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
11+
use Magento\Catalog\Model\Product\Option;
12+
13+
/**
14+
* Data provider with product custom options from date group(date, date & time, time).
15+
*/
16+
class DateGroupDataProvider
17+
{
18+
/**
19+
* Return options data.
20+
*
21+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
22+
*
23+
* @return array
24+
*/
25+
public function getData(): array
26+
{
27+
return [
28+
'type_date_required' => [
29+
[
30+
Option::KEY_TITLE => 'Test option date title 1',
31+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE,
32+
Option::KEY_IS_REQUIRE => 1,
33+
Option::KEY_PRICE => 10,
34+
Option::KEY_PRICE_TYPE => 'fixed',
35+
Option::KEY_SKU => 'test-option-date-title-1',
36+
],
37+
[
38+
'block_with_required_class' => '<div class="field date required"',
39+
'title' => '<span>Test option date title 1</span>',
40+
'price' => 'data-price-amount="10"',
41+
],
42+
],
43+
'type_date_not_required' => [
44+
[
45+
Option::KEY_TITLE => 'Test option date title 2',
46+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE,
47+
Option::KEY_IS_REQUIRE => 0,
48+
Option::KEY_PRICE => 10,
49+
Option::KEY_PRICE_TYPE => 'fixed',
50+
Option::KEY_SKU => 'test-option-date-title-2',
51+
],
52+
[
53+
'block_with_required_class' => '<div class="field date"',
54+
'title' => '<span>Test option date title 2</span>',
55+
'price' => 'data-price-amount="10"',
56+
],
57+
],
58+
'type_date_fixed_price' => [
59+
[
60+
Option::KEY_TITLE => 'Test option date title 3',
61+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE,
62+
Option::KEY_IS_REQUIRE => 0,
63+
Option::KEY_PRICE => 50,
64+
Option::KEY_PRICE_TYPE => 'fixed',
65+
Option::KEY_SKU => 'test-option-date-title-3',
66+
],
67+
[
68+
'block_with_required_class' => '<div class="field date"',
69+
'title' => '<span>Test option date title 3</span>',
70+
'price' => 'data-price-amount="50"',
71+
],
72+
],
73+
'type_date_percent_price' => [
74+
[
75+
Option::KEY_TITLE => 'Test option date title 4',
76+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE,
77+
Option::KEY_IS_REQUIRE => 0,
78+
Option::KEY_PRICE => 50,
79+
Option::KEY_PRICE_TYPE => 'percent',
80+
Option::KEY_SKU => 'test-option-date-title-4',
81+
],
82+
[
83+
'block_with_required_class' => '<div class="field date"',
84+
'title' => '<span>Test option date title 4</span>',
85+
'price' => 'data-price-amount="5"',
86+
],
87+
],
88+
'type_date_and_time_required' => [
89+
[
90+
Option::KEY_TITLE => 'Test option date and time title 1',
91+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME,
92+
Option::KEY_IS_REQUIRE => 1,
93+
Option::KEY_PRICE => 10,
94+
Option::KEY_PRICE_TYPE => 'fixed',
95+
Option::KEY_SKU => 'test-option-date-and-time-title-1',
96+
],
97+
[
98+
'block_with_required_class' => '<div class="field date required"',
99+
'title' => '<span>Test option date and time title 1</span>',
100+
'price' => 'data-price-amount="10"',
101+
],
102+
],
103+
'type_date_and_time_not_required' => [
104+
[
105+
Option::KEY_TITLE => 'Test option date and time title 2',
106+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME,
107+
Option::KEY_IS_REQUIRE => 0,
108+
Option::KEY_PRICE => 10,
109+
Option::KEY_PRICE_TYPE => 'fixed',
110+
Option::KEY_SKU => 'test-option-date-and-time-title-2',
111+
],
112+
[
113+
'block_with_required_class' => '<div class="field date"',
114+
'title' => '<span>Test option date and time title 2</span>',
115+
'price' => 'data-price-amount="10"',
116+
],
117+
],
118+
'type_date_and_time_fixed_price' => [
119+
[
120+
Option::KEY_TITLE => 'Test option date and time title 3',
121+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME,
122+
Option::KEY_IS_REQUIRE => 0,
123+
Option::KEY_PRICE => 50,
124+
Option::KEY_PRICE_TYPE => 'fixed',
125+
Option::KEY_SKU => 'test-option-date-and-time-title-3',
126+
],
127+
[
128+
'block_with_required_class' => '<div class="field date"',
129+
'title' => '<span>Test option date and time title 3</span>',
130+
'price' => 'data-price-amount="50"',
131+
],
132+
],
133+
'type_date_and_time_percent_price' => [
134+
[
135+
Option::KEY_TITLE => 'Test option date and time title 4',
136+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_DATE_TIME,
137+
Option::KEY_IS_REQUIRE => 0,
138+
Option::KEY_PRICE => 50,
139+
Option::KEY_PRICE_TYPE => 'percent',
140+
Option::KEY_SKU => 'test-option-date-and-time-title-4',
141+
],
142+
[
143+
'block_with_required_class' => '<div class="field date"',
144+
'title' => '<span>Test option date and time title 4</span>',
145+
'price' => 'data-price-amount="5"',
146+
],
147+
],
148+
'type_time_required' => [
149+
[
150+
Option::KEY_TITLE => 'Test option time title 1',
151+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME,
152+
Option::KEY_IS_REQUIRE => 1,
153+
Option::KEY_PRICE => 10,
154+
Option::KEY_PRICE_TYPE => 'fixed',
155+
Option::KEY_SKU => 'test-option-time-title-1',
156+
],
157+
[
158+
'block_with_required_class' => '<div class="field date required"',
159+
'title' => '<span>Test option time title 1</span>',
160+
'price' => 'data-price-amount="10"',
161+
],
162+
],
163+
'type_time_not_required' => [
164+
[
165+
Option::KEY_TITLE => 'Test option time title 2',
166+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME,
167+
Option::KEY_IS_REQUIRE => 0,
168+
Option::KEY_PRICE => 10,
169+
Option::KEY_PRICE_TYPE => 'fixed',
170+
Option::KEY_SKU => 'test-option-time-title-2',
171+
],
172+
[
173+
'block_with_required_class' => '<div class="field date"',
174+
'title' => '<span>Test option time title 2</span>',
175+
'price' => 'data-price-amount="10"',
176+
],
177+
],
178+
'type_time_fixed_price' => [
179+
[
180+
Option::KEY_TITLE => 'Test option time title 3',
181+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME,
182+
Option::KEY_IS_REQUIRE => 0,
183+
Option::KEY_PRICE => 50,
184+
Option::KEY_PRICE_TYPE => 'fixed',
185+
Option::KEY_SKU => 'test-option-time-title-3',
186+
],
187+
[
188+
'block_with_required_class' => '<div class="field date"',
189+
'title' => '<span>Test option time title 3</span>',
190+
'price' => 'data-price-amount="50"',
191+
],
192+
],
193+
'type_time_percent_price' => [
194+
[
195+
Option::KEY_TITLE => 'Test option time title 4',
196+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_TIME,
197+
Option::KEY_IS_REQUIRE => 0,
198+
Option::KEY_PRICE => 50,
199+
Option::KEY_PRICE_TYPE => 'percent',
200+
Option::KEY_SKU => 'test-option-time-title-4',
201+
],
202+
[
203+
'block_with_required_class' => '<div class="field date"',
204+
'title' => '<span>Test option time title 4</span>',
205+
'price' => 'data-price-amount="5"',
206+
],
207+
],
208+
];
209+
}
210+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestFramework\Catalog\Block\Product\View\Options;
9+
10+
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
11+
use Magento\Catalog\Model\Product\Option;
12+
13+
/**
14+
* Data provider with product custom options from file group(file).
15+
*/
16+
class FileGroupDataProvider
17+
{
18+
/**
19+
* Return options data.
20+
*
21+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
22+
*
23+
* @return array
24+
*/
25+
public function getData(): array
26+
{
27+
return [
28+
'type_file_required' => [
29+
[
30+
Option::KEY_TITLE => 'Test option file title 1',
31+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE,
32+
Option::KEY_IS_REQUIRE => 1,
33+
Option::KEY_PRICE => 10,
34+
Option::KEY_PRICE_TYPE => 'fixed',
35+
Option::KEY_SKU => 'test-option-file-title-1',
36+
Option::KEY_SORT_ORDER => 1,
37+
Option::KEY_FILE_EXTENSION => 'png, jpg',
38+
],
39+
[
40+
'block_with_required_class' => '<div class="field file required">',
41+
'label_for_created_option' => '<label class="label" for="options_%s_file"',
42+
'title' => '<span>Test option file title 1</span>',
43+
'price' => 'data-price-amount="10"',
44+
'required_element' => '/<input type="file"/',
45+
'file_extension' => '<strong>png, jpg</strong>',
46+
],
47+
],
48+
'type_file_not_required' => [
49+
[
50+
Option::KEY_TITLE => 'Test option file title 2',
51+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE,
52+
Option::KEY_IS_REQUIRE => 0,
53+
Option::KEY_PRICE => 10,
54+
Option::KEY_PRICE_TYPE => 'fixed',
55+
Option::KEY_SKU => 'test-option-file-title-2',
56+
Option::KEY_SORT_ORDER => 1,
57+
Option::KEY_FILE_EXTENSION => 'png, jpg',
58+
],
59+
[
60+
'block_with_required_class' => '<div class="field file">',
61+
'label_for_created_option' => '<label class="label" for="options_%s_file"',
62+
'title' => '<span>Test option file title 2</span>',
63+
'price' => 'data-price-amount="10"',
64+
'required_element' => '/<input type="file"/',
65+
'file_extension' => '<strong>png, jpg</strong>',
66+
],
67+
],
68+
'type_file_fixed_price' => [
69+
[
70+
Option::KEY_TITLE => 'Test option file title 3',
71+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE,
72+
Option::KEY_IS_REQUIRE => 0,
73+
Option::KEY_PRICE => 50,
74+
Option::KEY_PRICE_TYPE => 'fixed',
75+
Option::KEY_SKU => 'test-option-file-title-3',
76+
Option::KEY_SORT_ORDER => 1,
77+
Option::KEY_FILE_EXTENSION => 'png, jpg',
78+
],
79+
[
80+
'block_with_required_class' => '<div class="field file">',
81+
'label_for_created_option' => '<label class="label" for="options_%s_file"',
82+
'title' => '<span>Test option file title 3</span>',
83+
'price' => 'data-price-amount="50"',
84+
'required_element' => '/<input type="file"/',
85+
'file_extension' => '<strong>png, jpg</strong>',
86+
],
87+
],
88+
'type_file_percent_price' => [
89+
[
90+
Option::KEY_TITLE => 'Test option file title 4',
91+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE,
92+
Option::KEY_IS_REQUIRE => 0,
93+
Option::KEY_PRICE => 50,
94+
Option::KEY_PRICE_TYPE => 'percent',
95+
Option::KEY_SKU => 'test-option-file-title-4',
96+
Option::KEY_SORT_ORDER => 1,
97+
Option::KEY_FILE_EXTENSION => 'png, jpg',
98+
],
99+
[
100+
'block_with_required_class' => '<div class="field file">',
101+
'label_for_created_option' => '<label class="label" for="options_%s_file"',
102+
'title' => '<span>Test option file title 4</span>',
103+
'price' => 'data-price-amount="5"',
104+
'required_element' => '/<input type="file"/',
105+
'file_extension' => '<strong>png, jpg</strong>',
106+
],
107+
],
108+
'type_file_with_width_and_height' => [
109+
[
110+
Option::KEY_TITLE => 'Test option file title 5',
111+
Option::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FILE,
112+
Option::KEY_IS_REQUIRE => 0,
113+
Option::KEY_PRICE => 50,
114+
Option::KEY_PRICE_TYPE => 'percent',
115+
Option::KEY_SKU => 'test-option-file-title-5',
116+
Option::KEY_SORT_ORDER => 1,
117+
Option::KEY_FILE_EXTENSION => 'png, jpg',
118+
Option::KEY_IMAGE_SIZE_X => 10,
119+
Option::KEY_IMAGE_SIZE_Y => 81,
120+
],
121+
[
122+
'block_with_required_class' => '<div class="field file">',
123+
'label_for_created_option' => '<label class="label" for="options_%s_file"',
124+
'title' => '<span>Test option file title 5</span>',
125+
'price' => 'data-price-amount="5"',
126+
'required_element' => '/<input type="file"/',
127+
'file_extension' => '<strong>png, jpg</strong>',
128+
'file_width' => '/%s:.*<strong>10 px.<\/strong>/',
129+
'file_height' => '/%s:.*<strong>81 px.<\/strong>/',
130+
],
131+
],
132+
];
133+
}
134+
}

0 commit comments

Comments
 (0)