Skip to content
Extraits de code Groupes Projets
Valider a01e1d0b rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

refs #3227 added, improved integration tests

git-svn-id: http://dev.piwik.org/svn/trunk@6566 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent fcf0a106
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -20,14 +20,17 @@ class Test_Piwik_Integration_ApiGetReportMetadata extends IntegrationTestCase ...@@ -20,14 +20,17 @@ class Test_Piwik_Integration_ApiGetReportMetadata extends IntegrationTestCase
protected $idGoal2 = 2; protected $idGoal2 = 2;
protected $idGoal3 = 3; protected $idGoal3 = 3;
public function setUp() protected function setUpWebsitesAndGoals()
{ {
parent::setUp();
$this->createWebsite($this->dateTime, $ecommerce = 1); $this->createWebsite($this->dateTime, $ecommerce = 1);
Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'Goal 1 - Thank you', 'title', 'Thank you', 'contains', $caseSensitive = false, $revenue = 10, $allowMultipleConversions = 1); Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'Goal 1 - Thank you', 'title', 'Thank you', 'contains', $caseSensitive = false, $revenue = 10, $allowMultipleConversions = 1);
Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'Goal 2 - Hello', 'url', 'hellow', 'contains', $caseSensitive = false, $revenue = 10, $allowMultipleConversions = 0); Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'Goal 2 - Hello', 'url', 'hellow', 'contains', $caseSensitive = false, $revenue = 10, $allowMultipleConversions = 0);
Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'triggered js', 'manually', '', ''); Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'triggered js', 'manually', '', '');
$this->trackVisits(); }
public function setUp()
{
parent::setUp();
// From Piwik 1.5, we hide Goals.getConversions and other get* methods via @ignore, but we ensure that they still work // From Piwik 1.5, we hide Goals.getConversions and other get* methods via @ignore, but we ensure that they still work
// This hack allows the API proxy to let us generate example URLs for the ignored functions // This hack allows the API proxy to let us generate example URLs for the ignored functions
......
...@@ -16,12 +16,15 @@ class Test_Piwik_Integration_ApiGetReportMetadata_Year extends IntegrationTestCa ...@@ -16,12 +16,15 @@ class Test_Piwik_Integration_ApiGetReportMetadata_Year extends IntegrationTestCa
protected $idSite = 1; protected $idSite = 1;
protected $dateTime = '2009-01-04 00:11:42'; protected $dateTime = '2009-01-04 00:11:42';
public function setUp() protected function setUpWebsitesAndGoals()
{ {
parent::setUp();
$this->createWebsite($this->dateTime); $this->createWebsite($this->dateTime);
} }
protected function trackVisits()
{
}
public function getApiForTesting() public function getApiForTesting()
{ {
$params = array('idSite' => $this->idSite, $params = array('idSite' => $this->idSite,
......
...@@ -14,7 +14,6 @@ require_once dirname(__FILE__).'/TwoVisitsWithCustomVariablesTest.php'; ...@@ -14,7 +14,6 @@ require_once dirname(__FILE__).'/TwoVisitsWithCustomVariablesTest.php';
*/ */
class Test_Piwik_Integration_CsvExport extends Test_Piwik_Integration_TwoVisitsWithCustomVariables class Test_Piwik_Integration_CsvExport extends Test_Piwik_Integration_TwoVisitsWithCustomVariables
{ {
protected $useEscapedQuotes = false; protected $useEscapedQuotes = false;
protected $doExtraQuoteTests = false; protected $doExtraQuoteTests = false;
......
Ce diff est replié.
...@@ -53,16 +53,12 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables extends IntegrationTes ...@@ -53,16 +53,12 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables extends IntegrationTes
return 'twoVisitsWithCustomVariables'; return 'twoVisitsWithCustomVariables';
} }
public function setUp() protected function setUpWebsitesAndGoals()
{ {
parent::setUp();
// tests run in UTC, the Tracker in UTC // tests run in UTC, the Tracker in UTC
$this->createWebsite($this->dateTime); $this->createWebsite($this->dateTime);
Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'triggered js', 'manually', '', ''); Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'triggered js', 'manually', '', '');
Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'second goal', 'manually', '', ''); Piwik_Goals_API::getInstance()->addGoal($this->idSite, 'second goal', 'manually', '', '');
$this->trackVisits();
} }
protected function trackVisits() protected function trackVisits()
......
...@@ -76,8 +76,15 @@ abstract class IntegrationTestCase extends DatabaseTestCase ...@@ -76,8 +76,15 @@ abstract class IntegrationTestCase extends DatabaseTestCase
// disable shuffling of tag cloud visualization so output is consistent // disable shuffling of tag cloud visualization so output is consistent
Piwik_Visualization_Cloud::$debugDisableShuffle = true; Piwik_Visualization_Cloud::$debugDisableShuffle = true;
} }
$this->setUpWebsitesAndGoals();
$this->trackVisits();
} }
abstract protected function setUpWebsitesAndGoals();
abstract protected function trackVisits();
public function tearDown() public function tearDown()
{ {
parent::tearDown(); parent::tearDown();
......
...@@ -26,6 +26,9 @@ Piwik_Config::getInstance()->setTestEnvironment(); ...@@ -26,6 +26,9 @@ Piwik_Config::getInstance()->setTestEnvironment();
Piwik_Config::getInstance()->PluginsInstalled['PluginsInstalled'] = array(); Piwik_Config::getInstance()->PluginsInstalled['PluginsInstalled'] = array();
Piwik_Tracker::setTestEnvironment(); Piwik_Tracker::setTestEnvironment();
Piwik_DataTable_Manager::getInstance()->deleteAll();
Piwik_Option::getInstance()->clearCache();
Piwik_Site::clearCache();
Piwik_Common::deleteTrackerCache(); Piwik_Common::deleteTrackerCache();
include '../../piwik.php'; include '../../piwik.php';
......
...@@ -42,11 +42,13 @@ require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; ...@@ -42,11 +42,13 @@ require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
$_COOKIE = array(); $_COOKIE = array();
function dump($var) if(function_exists('dump')) {
{ function dump($var)
print("<pre>"); {
var_export($var); print("<pre>");
print("</pre>"); var_export($var);
print("</pre>");
}
} }
if(!function_exists('printDebug')) { if(!function_exists('printDebug')) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter