Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
_algorithm_base_data.php
Go to the documentation of this file.
1 <?php
11  // no products, no prices
12  [[], [], []],
13  // small prices
14  [
15  range(0.01, 0.08, 0.01),
16  range(1, 8, 1),
17  [['from' => 0, 'to' => 0.05, 'count' => 4], ['from' => 0.05, 'to' => '', 'count' => 4]]
18  ],
19  // zero price test
20  [
21  [0, 0.71, 0.89],
22  range(9, 11, 1),
23  [['from' => 0, 'to' => 0, 'count' => 1], ['from' => 0.5, 'to' => '', 'count' => 2]]
24  ],
25  // first quantile should be skipped
26  [
27  [
28  0.01,
29  0.01,
30  0.01,
31  0.01,
32  0.01,
33  0.01,
34  0.01,
35  0.01,
36  0.01,
37  0.01,
38  0.01,
39  0.03,
40  0.05,
41  0.05,
42  0.06,
43  0.07,
44  0.07,
45  0.08,
46  0.08,
47  0.09,
48  0.15,
49  ],
50  range(12, 32, 1),
51  [['from' => 0, 'to' => 0.05, 'count' => 12], ['from' => 0.05, 'to' => '', 'count' => 9]]
52  ],
53  // test if best rounding factor is used
54  [
55  [10.19, 10.2, 10.2, 10.2, 10.21],
56  range(33, 37, 1),
57  [['from' => 10.19, 'to' => 10.19, 'count' => 1], ['from' => 10.2, 'to' => '', 'count' => 4]]
58  ],
59  // quantiles interception
60  [
61  [
62  5.99,
63  5.99,
64  7.99,
65  8.99,
66  8.99,
67  9.99,
68  9.99,
69  9.99,
70  9.99,
71  9.99,
72  14.6,
73  15.99,
74  16,
75  16.99,
76  17,
77  17.5,
78  18.99,
79  19,
80  20.99,
81  24.99,
82  ],
83  range(38, 57, 1),
84  [
85  ['from' => 0, 'to' => 9, 'count' => 5],
86  ['from' => 9.99, 'to' => 9.99, 'count' => 5],
87  ['from' => 10, 'to' => '', 'count' => 10]
88  ]
89  ],
90  // test if best rounding factor is used
91  [
92  [10.18, 10.19, 10.19, 10.19, 10.2],
93  range(58, 62, 1),
94  [['from' => 0, 'to' => 10.2, 'count' => 4], ['from' => 10.2, 'to' => 10.2, 'count' => 1]]
95  ],
96  // test many equal values
97  [
98  array_merge([10.57], array_fill(0, 20, 10.58), [10.59]),
99  range(63, 84, 1),
100  [
101  ['from' => 10.57, 'to' => 10.57, 'count' => 1],
102  ['from' => 10.58, 'to' => 10.58, 'count' => 20],
103  ['from' => 10.59, 'to' => 10.59, 'count' => 1]
104  ]
105  ],
106  // test preventing low count in interval and rounding factor to have lower priority
107  [
108  [
109  0.01,
110  0.01,
111  0.01,
112  0.02,
113  0.02,
114  0.03,
115  0.03,
116  0.04,
117  0.04,
118  0.04,
119  0.05,
120  0.05,
121  0.05,
122  0.06,
123  0.06,
124  0.06,
125  0.06,
126  0.07,
127  0.07,
128  0.08,
129  0.08,
130  2.99,
131  5.99,
132  5.99,
133  5.99,
134  5.99,
135  5.99,
136  5.99,
137  5.99,
138  5.99,
139  5.99,
140  13.50,
141  15.99,
142  41.95,
143  69.99,
144  89.99,
145  99.99,
146  99.99,
147  160.99,
148  161.94,
149  199.99,
150  199.99,
151  199.99,
152  239.99,
153  329.99,
154  447.98,
155  550.00,
156  599.99,
157  699.99,
158  750.00,
159  847.97,
160  1599.99,
161  2699.99,
162  4999.95,
163  ],
164  range(85, 148, 1),
165  [
166  ['from' => 0, 'to' => 0.05, 'count' => 10],
167  // this is important, that not 0.06 is used to prevent low count in interval
168  ['from' => 0.05, 'to' => 0.07, 'count' => 7],
169  ['from' => 0.07, 'to' => 5, 'count' => 5],
170  ['from' => 5.99, 'to' => 5.99, 'count' => 9],
171  ['from' => 10, 'to' => 100, 'count' => 7],
172  ['from' => 100, 'to' => 500, 'count' => 8],
173  ['from' => 500, 'to' => '', 'count' => 8]
174  ]
175  ],
176 ];
177 
178 return $testCases;