Skip to content

Commit

Permalink
Fixes for test
Browse files Browse the repository at this point in the history
  • Loading branch information
AltamashShaikh committed Dec 5, 2024
1 parent f42c091 commit cc0f060
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 103 deletions.
25 changes: 10 additions & 15 deletions tests/System/TrackSeveralCampaignsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ public function getApiForTesting()
{
$dateWithPluginEnabled = self::$fixture->dateTimeWithPluginEnabled;
$dateTime = self::$fixture->dateTime;
$phpVersionPrefix = version_compare(PHP_VERSION, 8.4, '<') ? 'min_php_' : '';
$phpVersionPrefix = version_compare(PHP_VERSION, 8.3, '<') ? 'min_php_' : '';

$apiToTest[] = [
'API.get',
[
'idSite' => self::$fixture->idSite,
'date' => $dateWithPluginEnabled,
'periods' => ['day'],
'testSuffix' => $phpVersionPrefix . (version_compare(Version::VERSION, '5.2.0-b6', '<') ? 'old' : ''),
'testSuffix' => (!empty($phpVersionPrefix) ? $phpVersionPrefix : 'max_php_') . (version_compare(Version::VERSION, '5.2.0-b6', '<') ? 'old' : ''),
]
];

Expand All @@ -89,20 +89,15 @@ public function getApiForTesting()
$columnsToHide = ['referrerType', 'referrerName', 'referrerKeyword'];
}

$liveApiParams = [
'idSite' => self::$fixture->idSite,
'date' => $dateWithPluginEnabled,
'periods' => ['day'],
'xmlFieldsToRemove' => $columnsToHide,
];

if ($phpVersionPrefix) {
$liveApiParams['testSuffix'] = $phpVersionPrefix;
}

$apiToTest[] = [
'Live.getLastVisitsDetails',
$liveApiParams
[
'idSite' => self::$fixture->idSite,
'date' => $dateWithPluginEnabled,
'periods' => ['day'],
'xmlFieldsToRemove' => $columnsToHide,
'testSuffix' => $phpVersionPrefix,
]
];

$api = [
Expand Down Expand Up @@ -221,7 +216,7 @@ public function getReferrerApiForTesting()
'Referrers.getCampaigns',
];

$phpVersionPrefix = version_compare(PHP_VERSION, 8.4, '<') ? 'min_php_' : '';
$phpVersionPrefix = version_compare(PHP_VERSION, 8.3, '<') ? 'min_php_' : '';

$apiToTest[] = [
$api,
Expand Down
12 changes: 6 additions & 6 deletions tests/System/expected/test___Live.getLastVisitsDetails_day.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@


<referrerType>campaign</referrerType>
<referrerName>Ecommerce_campaign</referrerName>
<referrerKeyword>Ecommerce_keyword</referrerKeyword>
<referrerName>ecommerce_campaign</referrerName>
<referrerKeyword>ecommerce_keyword</referrerKeyword>
<itemDetails>
<row>
<itemSKU>item SKU</itemSKU>
Expand Down Expand Up @@ -200,8 +200,8 @@


<referrerType>campaign</referrerType>
<referrerName>Ecommerce_campaign</referrerName>
<referrerKeyword>Ecommerce_keyword</referrerKeyword>
<referrerName>ecommerce_campaign</referrerName>
<referrerKeyword>ecommerce_keyword</referrerKeyword>
<itemDetails>
<row>
<itemSKU>item SKU</itemSKU>
Expand Down Expand Up @@ -383,7 +383,7 @@

<url>http://example.com/anotherpage</url>
<referrerType>campaign</referrerType>
<referrerName>Campaign_with_two_goals_conversions</referrerName>
<referrerName>campaign_with_two_goals_conversions</referrerName>
<referrerKeyword />
<icon>plugins/Morpheus/images/goal.png</icon>
<iconSVG>plugins/Morpheus/images/goal.svg</iconSVG>
Expand All @@ -401,7 +401,7 @@

<url>http://example.com/anotherpage</url>
<referrerType>campaign</referrerType>
<referrerName>Campaign_with_two_goals_conversions</referrerName>
<referrerName>campaign_with_two_goals_conversions</referrerName>
<referrerKeyword />
<icon>plugins/Morpheus/images/goal.png</icon>
<iconSVG>plugins/Morpheus/images/goal.svg</iconSVG>
Expand Down
109 changes: 58 additions & 51 deletions tests/System/expected/test_expanded__Referrers.getCampaigns_day.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,6 @@
<sum_visit_length>1444</sum_visit_length>
<bounce_count>2</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
<segment>referrerType==campaign;referrerName==Ecommerce_campaign</segment>
<subtable>
<row>
Expand All @@ -42,26 +22,6 @@
<sum_visit_length>1444</sum_visit_length>
<bounce_count>2</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
</row>
</subtable>
</row>
Expand Down Expand Up @@ -312,15 +272,6 @@
<sum_visit_length>725</sum_visit_length>
<bounce_count>1</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<goals>
<row idgoal='2'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>3333</revenue>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>3333</revenue>
<segment>referrerType==campaign;referrerName==Campaign_with_two_goals_conversions</segment>
</row>
<row>
Expand Down Expand Up @@ -443,10 +394,66 @@
<nb_visits_converted>1</nb_visits_converted>
<revenue>1111</revenue>
</row>
<row idgoal='2'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>3333</revenue>
</row>
</goals>
<nb_conversions>2</nb_conversions>
<revenue>1111</revenue>
<nb_conversions>3</nb_conversions>
<revenue>4444</revenue>
<nb_visits>0</nb_visits>
<segment>referrerType==campaign;referrerName==campaign_with_two_goals_conversions</segment>
</row>
<row>
<label>ecommerce_campaign</label>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
<nb_visits>0</nb_visits>
<segment>referrerType==campaign;referrerName==ecommerce_campaign</segment>
<subtable>
<row>
<label>ecommerce_keyword</label>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
<nb_visits>0</nb_visits>
</row>
</subtable>
</row>
</result>
65 changes: 34 additions & 31 deletions tests/System/expected/test_flat__Referrers.getCampaigns_day.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,6 @@
<sum_visit_length>1444</sum_visit_length>
<bounce_count>2</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
<segment>referrerType==campaign;referrerName==Ecommerce_campaign;referrerType==campaign;referrerKeyword==Ecommerce_keyword</segment>
<Referrers_Campaign>Ecommerce_campaign</Referrers_Campaign>
<Referrers_Keyword>Ecommerce_keyword</Referrers_Keyword>
Expand Down Expand Up @@ -183,15 +163,6 @@
<sum_visit_length>725</sum_visit_length>
<bounce_count>1</bounce_count>
<nb_visits_converted>1</nb_visits_converted>
<goals>
<row idgoal='2'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>3333</revenue>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>3333</revenue>
<segment>referrerType==campaign;referrerName==Campaign_with_two_goals_conversions</segment>
<Referrers_Campaign>Campaign_with_two_goals_conversions</Referrers_Campaign>
</row>
Expand Down Expand Up @@ -272,11 +243,43 @@
<nb_visits_converted>1</nb_visits_converted>
<revenue>1111</revenue>
</row>
<row idgoal='2'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>3333</revenue>
</row>
</goals>
<nb_conversions>2</nb_conversions>
<revenue>1111</revenue>
<nb_conversions>3</nb_conversions>
<revenue>4444</revenue>
<nb_visits>0</nb_visits>
<segment>referrerType==campaign;referrerName==campaign_with_two_goals_conversions</segment>
<Referrers_Campaign>campaign_with_two_goals_conversions</Referrers_Campaign>
</row>
<row>
<label>ecommerce_campaign - ecommerce_keyword</label>
<goals>
<row idgoal='ecommerceAbandonedCart'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<items>5</items>
</row>
<row idgoal='ecommerceOrder'>
<nb_conversions>1</nb_conversions>
<nb_visits_converted>1</nb_visits_converted>
<revenue>555</revenue>
<revenue_subtotal>0</revenue_subtotal>
<revenue_tax>0</revenue_tax>
<revenue_shipping>0</revenue_shipping>
<revenue_discount>0</revenue_discount>
<items>5</items>
</row>
</goals>
<nb_conversions>1</nb_conversions>
<revenue>555</revenue>
<nb_visits>0</nb_visits>
<segment>referrerType==campaign;referrerName==ecommerce_campaign;referrerType==campaign;referrerKeyword==ecommerce_keyword</segment>
<Referrers_Campaign>ecommerce_campaign</Referrers_Campaign>
<Referrers_Keyword>ecommerce_keyword</Referrers_Keyword>
</row>
</result>
Loading

0 comments on commit cc0f060

Please sign in to comment.