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:
authorThomas Steur <tsteur@users.noreply.github.com>2020-10-01 03:18:11 +0300
committerGitHub <noreply@github.com>2020-10-01 03:18:11 +0300
commitfd14a155269038f6fe12ce31db20f8ebffaf00c5 (patch)
tree9afb319c7d8907fd5797d4cd6d9d6429c1a1c31b /plugins/SegmentEditor/tests
parenta79fccc1c7321ba0c3a2f3ceb9f5201be98e9476 (diff)
Add check for real time segments enabled/disabled in API (#16465)
Diffstat (limited to 'plugins/SegmentEditor/tests')
-rw-r--r--plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
index 81a1a77d53..ebb5656e5f 100644
--- a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
+++ b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
@@ -215,6 +215,29 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
]);
}
+ public function test_add_realTimeEnabledInApi_whenRealTimeDisabledInConfig()
+ {
+ $this->expectExceptionMessage('Real time segments are disabled. You need to enable auto archiving.');
+ $this->expectException(\Exception::class);
+ $config = Config::getInstance();
+ $general = $config->General;
+ $general['enable_create_realtime_segments'] = 0;
+ $config->General = $general;
+
+ API::getInstance()->add('testsegment', self::TEST_SEGMENT, $idSite = false, $autoArchive = false);
+ }
+
+ public function test_add_realTimeEnabledInApi_whenRealTimeEnabledInConfigShouldWork()
+ {
+ $config = Config::getInstance();
+ $general = $config->General;
+ $general['enable_create_realtime_segments'] = 1;
+ $config->General = $general;
+
+ $id = API::getInstance()->add('testsegment', self::TEST_SEGMENT, $idSite = false, $autoArchive = false);
+ $this->assertNotEmpty($id);
+ }
+
public static function getOutputPrefix()
{
return '';