@@ -30,6 +30,9 @@ public function testGetReport($expectedReportData, $ignoredContentTypes)
30
30
$ connectionFactoryMock ->expects ($ this ->once ())
31
31
->method ('getConnection ' )
32
32
->willReturn ($ resourceConnection );
33
+ // $iteratorFactoryMock = $this->createMock(\Magento\Analytics\ReportXml\IteratorFactory::class);
34
+ // $iteratorFactoryMock->expects($this->once())
35
+ // ->method('create');
33
36
/* @var $contentTypeUsageReportProvider \Magento\PageBuilderAnalytics\Model\ContentTypeUsageReportProvider */
34
37
$ contentTypeUsageReportProvider = Bootstrap::getObjectManager ()->create (
35
38
\Magento \PageBuilderAnalytics \Model \ContentTypeUsageReportProvider::class,
@@ -46,23 +49,18 @@ public function testGetReport($expectedReportData, $ignoredContentTypes)
46
49
}
47
50
48
51
foreach ($ reportData ->getInnerIterator () as $ reportItem ) {
49
- // Ignore the header within the report
50
- if ($ reportItem [0 ] === 'Content Type ' ) {
51
- continue ;
52
- }
53
-
54
52
// Skip over any ignored content types
55
- if (in_array ($ reportItem [0 ], $ ignoredContentTypes )) {
53
+ if (in_array ($ reportItem [' type ' ], $ ignoredContentTypes )) {
56
54
continue ;
57
55
}
58
56
59
57
// Verify we have expected report data for the content type
60
58
if (!isset ($ expectedReportData [$ reportItem [0 ]])) {
61
- $ this ->fail ('There is no report data for ' . $ reportItem [0 ] . '. ' );
59
+ $ this ->fail ('There is no report data for ' . $ reportItem [' type ' ] . '. ' );
62
60
}
63
61
64
62
// Verify the count values match the expected report data
65
- $ this ->assertEquals ($ expectedReportData [$ reportItem [0 ]], $ reportItem [1 ]);
63
+ $ this ->assertEquals ($ expectedReportData [$ reportItem [' type ' ]], $ reportItem [' count ' ]);
66
64
}
67
65
}
68
66
@@ -74,25 +72,25 @@ public function reportDataProvider(): array
74
72
return [
75
73
[
76
74
[
77
- ' button-item ' => 6 ,
78
- ' slide ' => 12 ,
79
- ' text ' => 1 ,
80
- ' image ' => 2 ,
81
- ' block ' => 1 ,
82
- ' row ' => 7 ,
83
- ' column-group ' => 5 ,
84
- ' column ' => 12 ,
85
- ' video ' => 2 ,
86
- ' heading ' => 3 ,
87
- ' tabs ' => 1 ,
88
- ' products ' => 0 ,
89
- ' tab-item ' => 2 ,
90
- ' banner ' => 4 ,
91
- ' buttons ' => 2 ,
92
- ' slider ' => 3 ,
93
- ' divider ' => 5 ,
94
- ' map ' => 2 ,
95
- ' html ' => 2
75
+ [ ' type ' => ' button-item ', ' count ' => 6 ] ,
76
+ [ ' type ' => ' slide ', ' count ' => 12 ] ,
77
+ [ ' type ' => ' text ', ' count ' => 1 ] ,
78
+ [ ' type ' => ' image ', ' count ' => 2 ] ,
79
+ [ ' type ' => ' block ', ' count ' => 1 ] ,
80
+ [ ' type ' => ' row ', ' count ' => 7 ] ,
81
+ [ ' type ' => ' column-group ', ' count ' => 5 ] ,
82
+ [ ' type ' => ' column ', ' count ' => 12 ] ,
83
+ [ ' type ' => ' video ', ' count ' => 2 ] ,
84
+ [ ' type ' => ' heading ', ' count ' => 3 ] ,
85
+ [ ' type ' => ' tabs ', ' count ' => 1 ] ,
86
+ [ ' type ' => ' products ', ' count ' => 0 ] ,
87
+ [ ' type ' => ' tab-item ', ' count ' => 2 ] ,
88
+ [ ' type ' => ' banner ', ' count ' => 4 ] ,
89
+ [ ' type ' => ' buttons ', ' count ' => 2 ] ,
90
+ [ ' type ' => ' slider ', ' count ' => 3 ] ,
91
+ [ ' type ' => ' divider ', ' count ' => 5 ] ,
92
+ [ ' type ' => ' map ', ' count ' => 2 ] ,
93
+ [ ' type ' => ' html ', ' count ' => 2 ]
96
94
],
97
95
// Ignored content types
98
96
[
0 commit comments