diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-11-17 07:51:15 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-11-17 07:51:15 +0300 |
commit | 851109cc5607e115e92f2e03ddecc64545d49735 (patch) | |
tree | 4c840f1f6937c11ef4960f8eb48fae3316be1048 /tests/PHPUnit/System/AutoSuggestAPITest.php | |
parent | 5471b147ec88e08fb2c8699f70676a9af369e67f (diff) |
Green Hope
Diffstat (limited to 'tests/PHPUnit/System/AutoSuggestAPITest.php')
-rw-r--r-- | tests/PHPUnit/System/AutoSuggestAPITest.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/PHPUnit/System/AutoSuggestAPITest.php b/tests/PHPUnit/System/AutoSuggestAPITest.php index 22780af180..d4d848a9a7 100644 --- a/tests/PHPUnit/System/AutoSuggestAPITest.php +++ b/tests/PHPUnit/System/AutoSuggestAPITest.php @@ -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(); |