Skip to content
Extraits de code Groupes Projets
Valider 7eec4085 rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Remove dates from the XML being compared since the test tests with last7,...

Remove dates from the XML being compared since the test tests with last7, {day-6},now and {day-6},today which read differently but refer to the same date

git-svn-id: http://dev.piwik.org/svn/trunk@6945 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 8989291e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -758,6 +758,14 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
$response = $this->removeXmlElement($response, 'sum_daily_nb_uniq_visitors');
$expected = $this->removeXmlElement($expected, 'nb_visits_converted');
$response = $this->removeXmlElement($response, 'nb_visits_converted');
if (strpos($requestUrl, 'date=') !== false)
{
$regex = "/date=[-0-9,%Ca-z]+/"; // need to remove %2C which is encoded ,
$expected = preg_replace($regex, 'date=', $expected);
$response = preg_replace($regex, 'date=', $response);
}
}
// if idSubtable is in request URL, make sure idSubtable values are not in any urls
......@@ -820,6 +828,9 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase
protected function removeXmlElement($input, $xmlElement, $testNotSmallAfter = true)
{
// Only raise error if there was some data before
$testNotSmallAfter = strlen($input > 100 ) && $testNotSmallAfter;
$input = preg_replace('/(<'.$xmlElement.'>.+?<\/'.$xmlElement.'>)/', '', $input);
//check we didn't delete the whole string
if($testNotSmallAfter)
......
......@@ -200,4 +200,4 @@
</metadata>
</result>
</result>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<result>
<error message="Row evolutions can not be processed with this combination of \'date\' and \'period\' parameters." />
<error message="Row evolutions can not be processed with this combination of \'date\' and \'period\' parameters." />
</result>
\ No newline at end of file
......@@ -7,4 +7,4 @@
<result date="2009-01-08" />
<result date="2009-01-09" />
<result date="2009-01-10" />
</results>
</results>
\ No newline at end of file
......@@ -7,4 +7,4 @@
<result date="From 2009-01-26 to 2009-02-01" />
<result date="From 2009-02-02 to 2009-02-08" />
<result date="From 2009-02-09 to 2009-02-15" />
</results>
</results>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<result>
<website>Piwik test</website>
<prettyDate>5 Aug 12 - 11 Aug 12</prettyDate>
<metadata>
<category>Visitors</category>
<name>Country</name>
......@@ -41,7 +41,8 @@
<revenue_per_visit>Revenue per Visit</revenue_per_visit>
</processedMetricsGoal>
<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserCountry&amp;apiAction=getCountry&amp;period=range&amp;date=last7</imageGraphUrl>
<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserCountry&amp;apiAction=getCountry&amp;period=range&amp;date=</imageGraphUrl>
<imageGraphEvolutionUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=UserCountry&amp;apiAction=getCountry&amp;period=day&amp;date=</imageGraphEvolutionUrl>
<uniqueId>UserCountry_getCountry</uniqueId>
</metadata>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter