File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ class AnalyticsParams implements ParamsInterface
1414
1515 public function toArray (): array
1616 {
17- return get_object_vars ($ this );
17+ $ arr = get_object_vars ($ this );
18+
19+ if ($ this ->end ) $ arr ['end ' ] = $ this ->end ->format ('Y-m-d ' );
20+ if ($ this ->start ) $ arr ['start ' ] = $ this ->start ->format ('Y-m-d ' );
21+
22+ return $ arr ;
1823 }
1924
2025 public function getStart (): ?DateTime
Original file line number Diff line number Diff line change 33namespace Seven \Tests ;
44
55use Seven \Api \Resource \Analytics \AbstractAnalytic ;
6+ use Seven \Api \Resource \Analytics \AnalyticsParams ;
67
78class AnalyticsTest extends BaseTest {
89 public function testAnalyticsByDate (): void {
@@ -47,6 +48,14 @@ public function testAnalyticsByLabel(): void {
4748 $ this ->expectNotToPerformAssertions ();
4849 }
4950
51+ public function testAnalyticsByLabelDated (): void {
52+ $ params = new AnalyticsParams ();
53+ $ params ->setStart (\DateTime::createFromFormat ('U ' , (string )time ()));
54+ $ params ->setEnd (\DateTime::createFromFormat ('U ' , (string )time ()));
55+ $ arr = $ this ->resources ->analytics ->byLabel ($ params );
56+ $ this ->expectNotToPerformAssertions ();
57+ }
58+
5059 public function testAnalyticsByCountry (): void {
5160 $ arr = $ this ->resources ->analytics ->byCountry ();
5261 //foreach ($arr as $item) {}
You can’t perform that action at this time.
0 commit comments