Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Flamis <zoltan@innocraft.com>2021-04-19 01:18:49 +0300
committerGitHub <noreply@github.com>2021-04-19 01:18:49 +0300
commit7b1b36c46559ee71c144152a0d95cd41e162e1dc (patch)
tree3223186fdfd371f5f21d16b7e5acbc03e5a206c6 /plugins/SegmentEditor/tests
parent84b9f9c33ce6402556008c8764a79747f24b5b0f (diff)
store segment hash in DB (#17408)
* get segment hash * convert tab indentations to spaces * Create 4.3.0-b2.php * update tests and update file * bump version * Update 4.3.0-b3.php * Update ApiTest.php * fixing urlencode bugs * cache segment hashes * update segment caching * update segment caching * add segment cache test * add testdox to phpunit.xml * revert phunit.xml * test investigation * Update phpunit.xml.dist * update blobreportlimitingt test * Revert "update blobreportlimitingt test" This reverts commit 90fe7355cd1d227193f0b73ddf1d715c8b016616. * Update phpunit.xml.dist * Update BlobReportLimitingTest.php * Update BlobReportLimitingTest.php * Update SystemTestCase.php * Update BlobReportLimitingTest.php * Update SystemTestCase.php * Update phpunit.xml.dist * modify mem limit for travis * Update .travis.yml * revert travis.yml * Update SystemTestCase.php * try test without cache * test witch cache and gc_disabled * Revert "test witch cache and gc_disabled" This reverts commit 7e1d37093c7be648a84b57335edf397c89913758. * test witch cache and gc_disabled * use other model method * refactor test * Workaround error in Overlay when site has no URLs (#17457) * Set setting value even if set to NULL so it will still be validated. * Make sure when creating a site that the urls options is set. * workaround in Overlay for instances that have an invalid site URL set for some reason * Add integration tests for changes to SitesManager API. * revert non-overlay changes * Add warning if site has no URLs when viewing Overlay. * add more tests for segment caches * get segment hash * convert tab indentations to spaces * Create 4.3.0-b2.php * update tests and update file * bump version * Update 4.3.0-b3.php * Update ApiTest.php * fixing urlencode bugs * cache segment hashes * update segment caching * update segment caching * add segment cache test * add testdox to phpunit.xml * revert phunit.xml * test investigation * Update phpunit.xml.dist * update blobreportlimitingt test * Revert "update blobreportlimitingt test" This reverts commit 90fe7355cd1d227193f0b73ddf1d715c8b016616. * Update phpunit.xml.dist * Update BlobReportLimitingTest.php * Update BlobReportLimitingTest.php * Update SystemTestCase.php * Update BlobReportLimitingTest.php * Update SystemTestCase.php * Update phpunit.xml.dist * modify mem limit for travis * Update .travis.yml * revert travis.yml * Update SystemTestCase.php * try test without cache * test witch cache and gc_disabled * Revert "test witch cache and gc_disabled" This reverts commit 7e1d37093c7be648a84b57335edf397c89913758. * test witch cache and gc_disabled * use other model method * refactor test * add more tests for segment caches * revert phpunit.xml * revert phpunit.xml * add more tests Co-authored-by: dizzy <diosmosis@users.noreply.github.com>
Diffstat (limited to 'plugins/SegmentEditor/tests')
-rw-r--r--plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php5
-rw-r--r--plugins/SegmentEditor/tests/System/ApiTest.php33
2 files changed, 36 insertions, 2 deletions
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
index ec594117a9..09430ca9be 100644
--- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
+++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
@@ -72,9 +72,10 @@ class SegmentEditorTest extends IntegrationTestCase
$segment = API::getInstance()->get($idSegment);
unset($segment['ts_created']);
$expected = array(
- 'idsegment' => 1,
+ 'idsegment' => '1',
'name' => $name,
'definition' => $definition,
+ 'hash' => md5($definition),
'login' => 'superUserLogin',
'enable_all_users' => '0',
'enable_only_idsite' => '0',
@@ -104,6 +105,7 @@ class SegmentEditorTest extends IntegrationTestCase
'idsegment' => '1',
'name' => $name,
'definition' => $definition,
+ 'hash' => md5($definition),
'login' => 'superUserLogin',
'enable_all_users' => '1',
'enable_only_idsite' => '1',
@@ -145,6 +147,7 @@ class SegmentEditorTest extends IntegrationTestCase
'idsegment' => $idSegment2,
'name' => 'NEW name',
'definition' => 'searches==0',
+ 'hash' => md5('searches==0'),
'enable_only_idsite' => '0',
'enable_all_users' => '0',
'auto_archive' => '1',
diff --git a/plugins/SegmentEditor/tests/System/ApiTest.php b/plugins/SegmentEditor/tests/System/ApiTest.php
index 0ae9dea78c..2b8d881490 100644
--- a/plugins/SegmentEditor/tests/System/ApiTest.php
+++ b/plugins/SegmentEditor/tests/System/ApiTest.php
@@ -62,4 +62,35 @@ class ApiTest extends SystemTestCase
$this->assertEquals($segmentApiHash, $segmentDefinitionHash);
}
-} \ No newline at end of file
+
+ /**
+ * @dataProvider definitionsDataProvider
+ */
+ public function test_generatedSegmentHash($definition)
+ {
+ Fixture::createWebsite('2020-03-03 00:00:00');
+
+ Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
+ self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
+ self::$fixture->getTestEnvironment()->save();
+
+ $idSegment = SegmentEditorApi::getInstance()->add('test segment', $definition, 1, 1, 1);
+ $segment = SegmentEditorApi::getInstance()->get($idSegment);
+
+ $hash = $segment['hash'];
+ $generatedHash = md5(urldecode($segment['definition']));
+
+ $this->assertEquals($generatedHash, $hash);
+ }
+
+ public function definitionsDataProvider()
+ {
+ return [
+ ['pageUrl=@%252F1'],
+ ['actions>=1'],
+ ['operatingSystemName==Ubuntu;browserName==Firefox'],
+ ['pageUrl==https%253A%252F%252Fmatomo.org%252Fpricing%252F'],
+ ['visitIp>=80.229.0.0;visitIp<=80.229.255.255'],
+ ];
+ }
+}