Skip to content

Commit 3933f81

Browse files
committed
MC-1426: Collect PageBuilder Content Type Data for PageBuilder Analytics
Key array by type in order facilitate lookup in ContentTypeUsageReportProviderTest::testGetReport
1 parent 6350418 commit 3933f81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dev/tests/integration/testsuite/Magento/CmsPageBuilderAnalytics/Model/ContentTypeUsageReportProviderTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ public function testGetReport($expectedReportData, $ignoredContentTypes)
4545
$reportData = $contentTypeUsageReportProvider->getReport('pagebuilder_page_cms_test');
4646
}
4747

48+
$expectedReportDataByType = array_combine(array_column($expectedReportData, 'type'), $expectedReportData);
49+
4850
foreach ($reportData->getInnerIterator() as $reportItem) {
4951
// Skip over any ignored content types
5052
if (in_array($reportItem['type'], $ignoredContentTypes)) {
5153
continue;
5254
}
5355

5456
// Verify we have expected report data for the content type
55-
if (!isset($expectedReportData[$reportItem['type']])) {
57+
if (!isset($expectedReportDataByType[$reportItem['type']])) {
5658
$this->fail('There is no report data for ' . $reportItem['type'] . '.');
5759
}
5860

5961
// Verify the count values match the expected report data
60-
$this->assertEquals($expectedReportData[$reportItem['type']], $reportItem['count']);
62+
$this->assertEquals($expectedReportDataByType[$reportItem['type']]['count'], $reportItem['count']);
6163
}
6264
}
6365

0 commit comments

Comments
 (0)