diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-11-04 10:19:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 10:19:48 +0300 |
commit | 375dd9f6933dcf7eeb37df9d2d9f44d16f35a277 (patch) | |
tree | 135baa9b8f9f2b2758ab9adf899d4026b8a91218 /plugins/SegmentEditor/tests/Integration | |
parent | 6b12f37eb630d25dffa13e315b894abda80ed5af (diff) |
several changes to emphasize setup and use of auto-archiving rather than real-time processing (#16603)
* several changes to emphasize setup and use of auto-archiving rather than real-time processing
* apply some pr feedback
* Applying more pr feedback.
* apply review fixes
* ignore ability to archive segments in real time
* another tweak
* update tests
* fix another test
* fix ui tests
* update test
* fix evolution icon bug
* Update TreemapVisualization and update expected screenshots
* update screenshots
Diffstat (limited to 'plugins/SegmentEditor/tests/Integration')
3 files changed, 22 insertions, 10 deletions
diff --git a/plugins/SegmentEditor/tests/Integration/ApiTest.php b/plugins/SegmentEditor/tests/Integration/ApiTest.php index 88bef59bad..13e0fd3357 100644 --- a/plugins/SegmentEditor/tests/Integration/ApiTest.php +++ b/plugins/SegmentEditor/tests/Integration/ApiTest.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\SegmentEditor\tests\Integration; +use Piwik\ArchiveProcessor\Rules; use Piwik\Plugins\SegmentEditor\API; use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\Mock\FakeAccess; @@ -152,6 +153,7 @@ class ApiTest extends IntegrationTestCase */ protected function createSegments() { + Rules::setBrowserTriggerArchiving(false); $this->setAdminUser(); $this->api->add('segment 1', 'visitCount<2', $idSite = 1, $autoArchive = true, $enableAllUsers = false); $this->api->add('segment 2', 'countryCode==fr', $idSite = 2, $autoArchive = false, $enableAllUsers = false); @@ -170,6 +172,7 @@ class ApiTest extends IntegrationTestCase $this->setAnotherSuperUser(); $this->api->add('segment 9', 'countryCode!=fr', $idSite = false, $autoArchive = false, $enableAllUsers = true); + Rules::setBrowserTriggerArchiving(true); } diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php index 07e2152739..95ed3c12bb 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\SegmentEditor\tests\Integration; +use Piwik\ArchiveProcessor\Rules; use Piwik\Date; use Piwik\Piwik; use Piwik\Plugins\SegmentEditor\API; @@ -47,16 +48,13 @@ class SegmentEditorTest extends IntegrationTestCase */ public function testAddInvalidSegment_ShouldThrow() { - try { - API::getInstance()->add('name', 'test==test2'); - $this->fail("Exception not raised."); - } catch (Exception $expected) { - } - try { - API::getInstance()->add('name', 'test'); - $this->fail("Exception not raised."); - } catch (Exception $expected) { - } + $this->expectException(\Exception::class); + + API::getInstance()->add('name', 'test==test2'); + $this->fail("Exception not raised."); + + API::getInstance()->add('name', 'test'); + $this->fail("Exception not raised."); } /** @@ -90,6 +88,8 @@ class SegmentEditorTest extends IntegrationTestCase */ public function test_AddAndGet_AnotherSegment() { + Rules::setBrowserTriggerArchiving(false); + $name = 'name'; $definition = 'searches>1,visitIp!=127.0.0.1'; $idSegment = API::getInstance()->add($name, $definition, $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1); @@ -135,6 +135,8 @@ class SegmentEditorTest extends IntegrationTestCase */ public function test_UpdateSegment() { + Rules::setBrowserTriggerArchiving(false); + $name = 'name"'; $definition = 'searches>1,visitIp!=127.0.0.1'; $nameSegment1 = 'hello'; @@ -179,6 +181,8 @@ class SegmentEditorTest extends IntegrationTestCase */ public function test_deleteSegment() { + Rules::setBrowserTriggerArchiving(false); + $idSegment1 = API::getInstance()->add('name 1', 'searches==0', $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1); $idSegment2 = API::getInstance()->add('name 2', 'searches>1,visitIp!=127.0.0.1', $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1); diff --git a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php index e9d18a63fd..7cf0c46de3 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php @@ -8,6 +8,7 @@ namespace Piwik\Plugins\SegmentEditor\tests\Integration; +use Piwik\ArchiveProcessor\Rules; use Piwik\Plugins\SegmentEditor\API; use Piwik\Plugins\SegmentEditor\SegmentQueryDecorator; use Piwik\Segment; @@ -36,6 +37,8 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase $this->segmentQueryDecorator = self::$fixture->piwikEnvironment->getContainer()->get( 'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator'); + Rules::setBrowserTriggerArchiving(false); + /** @var API $segmentEditorApi */ $segmentEditorApi = self::$fixture->piwikEnvironment->getContainer()->get( 'Piwik\Plugins\SegmentEditor\API'); @@ -47,6 +50,8 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase // test that segments w/ auto archive == false are included $segmentEditorApi->add('segment 5', 'visitCount<2', 3, $autoArchive = false); $segmentEditorApi->add('segment 6', 'countryCode!=fr', 3, $autoArchive = false); + + Rules::setBrowserTriggerArchiving(true); } /** |