@@ -72,20 +72,20 @@ public function testTableSelection($period, $expectedTable, $dateFrom, $dateTo,
72
72
$ this ->assertArrayHasKey ('tableName ' , $ from [$ dbTableName ]);
73
73
} else {
74
74
$ union = $ this ->_collection ->getSelect ()->getPart ('union ' );
75
+ $ count = count ($ union );
75
76
if ($ period !== null && $ dateFrom !== null && $ dateTo !== null && $ period != 'month ' ) {
76
- $ count = count ($ union );
77
77
if ($ period == 'year ' ) {
78
78
if ($ dbTableName == "report_viewed_product_aggregated_daily " ) {
79
- $ this ->assertEquals ($ count , 2 );
79
+ $ this ->assertEquals (2 , $ count );
80
80
}
81
81
if ($ dbTableName == "report_viewed_product_aggregated_yearly " ) {
82
- $ this ->assertEquals ($ count , 3 );
82
+ $ this ->assertEquals (3 , $ count );
83
83
}
84
84
} else {
85
- $ this ->assertEquals ($ count , 3 );
85
+ $ this ->assertEquals (3 , $ count );
86
86
}
87
87
} else {
88
- $ this ->assertEquals (count ( $ union ), 2 );
88
+ $ this ->assertEquals (2 , $ count );
89
89
}
90
90
}
91
91
}
@@ -98,8 +98,8 @@ public function testTableSelection($period, $expectedTable, $dateFrom, $dateTo,
98
98
*/
99
99
public function tableForPeriodDataProvider ()
100
100
{
101
- $ dateNow = date ( ' Y-m-d ' , time ()) ;
102
- $ dateYearAgo = date ('Y-m-d ' , strtotime ($ dateNow . ' -1 year ' ));
101
+ $ dateFrom = ' 2019-10-15 ' ;
102
+ $ dateYearBefore = date ('Y-m-d ' , strtotime ($ dateFrom . ' -1 year ' ));
103
103
return [
104
104
[
105
105
'period ' => 'year ' ,
@@ -111,32 +111,32 @@ public function tableForPeriodDataProvider()
111
111
[
112
112
'period ' => 'year ' ,
113
113
'table ' => 'report_viewed_product_aggregated_yearly ' ,
114
- 'date_from ' => $ dateYearAgo ,
115
- 'date_to ' => $ dateNow ,
114
+ 'date_from ' => $ dateYearBefore ,
115
+ 'date_to ' => $ dateFrom ,
116
116
],
117
117
[
118
118
'period ' => 'year ' ,
119
119
'table ' => 'report_viewed_product_aggregated_yearly ' ,
120
- 'date_from ' => $ dateYearAgo ,
120
+ 'date_from ' => $ dateYearBefore ,
121
121
'date_to ' => null ,
122
122
],
123
123
[
124
124
'period ' => 'month ' ,
125
125
'table ' => 'report_viewed_product_aggregated_monthly ' ,
126
126
'date_from ' => null ,
127
- 'date_to ' => $ dateNow ,
127
+ 'date_to ' => $ dateFrom ,
128
128
],
129
129
[
130
130
'period ' => 'year ' ,
131
131
'table ' => 'report_viewed_product_aggregated_yearly ' ,
132
- 'date_from ' => $ dateYearAgo ,
132
+ 'date_from ' => $ dateYearBefore ,
133
133
'date_to ' => null ,
134
134
],
135
135
[
136
136
'period ' => 'year ' ,
137
137
'table ' => 'report_viewed_product_aggregated_yearly ' ,
138
138
'date_from ' => null ,
139
- 'date_to ' => $ dateNow ,
139
+ 'date_to ' => $ dateFrom ,
140
140
],
141
141
[
142
142
'period ' => 'month ' ,
@@ -147,19 +147,19 @@ public function tableForPeriodDataProvider()
147
147
[
148
148
'period ' => 'month ' ,
149
149
'table ' => 'report_viewed_product_aggregated_monthly ' ,
150
- 'date_from ' => $ dateYearAgo ,
151
- 'date_to ' => $ dateYearAgo ,
150
+ 'date_from ' => $ dateYearBefore ,
151
+ 'date_to ' => $ dateYearBefore ,
152
152
],
153
153
[
154
154
'period ' => 'month ' ,
155
155
'table ' => 'report_viewed_product_aggregated_monthly ' ,
156
156
'date_from ' => null ,
157
- 'date_to ' => $ dateYearAgo ,
157
+ 'date_to ' => $ dateYearBefore ,
158
158
],
159
159
[
160
160
'period ' => 'month ' ,
161
161
'table ' => 'report_viewed_product_aggregated_monthly ' ,
162
- 'date_from ' => $ dateYearAgo ,
162
+ 'date_from ' => $ dateYearBefore ,
163
163
'date_to ' => null ,
164
164
],
165
165
[
@@ -177,32 +177,32 @@ public function tableForPeriodDataProvider()
177
177
[
178
178
'period ' => null ,
179
179
'table ' => 'report_viewed_product_aggregated_daily ' ,
180
- 'date_from ' => $ dateYearAgo ,
181
- 'date_to ' => $ dateNow ,
180
+ 'date_from ' => $ dateYearBefore ,
181
+ 'date_to ' => $ dateFrom ,
182
182
],
183
183
[
184
184
'period ' => null ,
185
185
'table ' => 'report_viewed_product_aggregated_daily ' ,
186
- 'date_from ' => $ dateNow ,
187
- 'date_to ' => $ dateNow ,
186
+ 'date_from ' => $ dateFrom ,
187
+ 'date_to ' => $ dateFrom ,
188
188
],
189
189
[
190
190
'period ' => 'day ' ,
191
191
'table ' => 'report_viewed_product_aggregated_daily ' ,
192
- 'date_from ' => $ dateYearAgo ,
193
- 'date_to ' => $ dateYearAgo ,
192
+ 'date_from ' => $ dateYearBefore ,
193
+ 'date_to ' => $ dateYearBefore ,
194
194
],
195
195
[
196
196
'period ' => 'year ' ,
197
197
'table ' => 'report_viewed_product_aggregated_daily ' ,
198
- 'date_from ' => $ dateYearAgo ,
199
- 'date_to ' => $ dateYearAgo ,
198
+ 'date_from ' => $ dateYearBefore ,
199
+ 'date_to ' => $ dateYearBefore ,
200
200
],
201
201
[
202
202
'period ' => 'year ' ,
203
203
'table ' => 'report_viewed_product_aggregated_daily ' ,
204
204
'date_from ' => null ,
205
- 'date_to ' => $ dateYearAgo ,
205
+ 'date_to ' => $ dateYearBefore ,
206
206
],
207
207
[
208
208
'period ' => null ,
0 commit comments