Skip to content
Extraits de code Groupes Projets
Valider 851109cc rédigé par mattab's avatar mattab
Parcourir les fichiers

Green Hope

parent 5471b147
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -119,6 +119,8 @@ class AutoSuggestAPITest extends SystemTestCase
public function getAnotherApiForTesting()
{
$apiForTesting = array();
$segments = \Piwik\Plugins\API\API::getInstance()->getSegmentsMetadata(self::$fixture->idSite);
foreach ($segments as $segment) {
......@@ -143,14 +145,27 @@ class AutoSuggestAPITest extends SystemTestCase
{
// Check that only a few haven't been tested specifically (these are all custom variables slots since we only test slot 1, 2, 5 (see the fixture) and example dimension slots)
$maximumSegmentsToSkip = 16;
$this->assertTrue(count(self::$skipped) <= $maximumSegmentsToSkip, 'SKIPPED ' . count(self::$skipped) . ' segments --> some segments had no "auto-suggested values"
$this->assertLessThan($maximumSegmentsToSkip, count(self::$skipped) , 'SKIPPED ' . count(self::$skipped) . ' segments --> some segments had no "auto-suggested values"
but we should try and test the autosuggest for all new segments. Segments skipped were: ' . implode(', ', self::$skipped));
// and check that most others have been tested
$minimumSegmentsToTest = 46;
$message = 'PROCESSED ' . self::$processed . ' segments --> it seems some segments "auto-suggested values" haven\'t been tested as we were expecting. ';
$this->assertTrue(self::$processed >= $minimumSegmentsToTest, $message);
$this->assertGreaterThan($minimumSegmentsToTest, self::$processed, $message);
}
public static function getSegmentsMetadata($idSite)
{
// Refresh cache for CustomVariables\Model
Cache::clearCacheGeneral();
\Piwik\Plugins\CustomVariables\Model::install();
// Segment matching NONE
$segments = \Piwik\Plugins\API\API::getInstance()->getSegmentsMetadata($idSite);
return $segments;
}
}
AutoSuggestAPITest::$fixture = new ManyVisitsWithGeoIP();
......
......@@ -7,12 +7,9 @@
*/
namespace Piwik\Tests\System;
use Piwik\Plugins\API\API;
use Piwik\Plugins\CustomVariables\Model;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tracker\Cache;
/**
* testing a segment containing all supported fields
......@@ -50,12 +47,7 @@ class TwoVisitsWithCustomVariablesSegmentMatchNONETest extends SystemTestCase
public function getSegmentToTest()
{
// Refresh cache for CustomVariables\Model
Cache::clearCacheGeneral();
Model::install();
// Segment matching NONE
$segments = API::getInstance()->getSegmentsMetadata(self::$fixture->idSite);
$segments = AutoSuggestAPITest::getSegmentsMetadata(self::$fixture->idSite);
$minimumExpectedSegmentsCount = 55; // as of Piwik 1.12
$this->assertGreaterThan($minimumExpectedSegmentsCount, count($segments));
......@@ -93,6 +85,7 @@ class TwoVisitsWithCustomVariablesSegmentMatchNONETest extends SystemTestCase
{
return 'twoVisitsWithCustomVariables_segmentMatchNONE';
}
}
TwoVisitsWithCustomVariablesSegmentMatchNONETest::$fixture = new TwoVisitsWithCustomVariables();
......
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