diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-05-25 21:09:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-25 21:09:21 +0300 |
commit | dd744fe3516a29c6a839c5b62da7ffd91c4906fe (patch) | |
tree | 364a78c61d3102944f20238a0030b4b26ecbbd2c /plugins/CoreHome | |
parent | 0aa4ca5223937e34f0d97903ea1f4bca169360b1 (diff) |
Fix uncaught exception when running system tests for plugins (#17618)
* Fix uncaught exception when running system tests for plugins
* updates expected test files
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r-- | plugins/CoreHome/Columns/VisitorId.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/CoreHome/Columns/VisitorId.php b/plugins/CoreHome/Columns/VisitorId.php index 6d7643984e..f6b29699b3 100644 --- a/plugins/CoreHome/Columns/VisitorId.php +++ b/plugins/CoreHome/Columns/VisitorId.php @@ -44,12 +44,18 @@ class VisitorId extends VisitDimension public function configureSegments(SegmentsList $segmentsList, DimensionSegmentFactory $dimensionSegmentFactory) { - $systemSettings = new SystemSettings(); - $a = $systemSettings->disableVisitorProfile->getValue(); - $b = $systemSettings->disableVisitorLog->getValue(); + try { + $systemSettings = new SystemSettings(); + $visitorProfileEnabled = $systemSettings->disableVisitorProfile->getValue() === false + && $systemSettings->disableVisitorLog->getValue() === false; + } catch (\Zend_Db_Exception $e) { + // when running tests the db might not yet be set up when fetching available segments + if (!defined('PIWIK_TEST_MODE') || !PIWIK_TEST_MODE) { + throw $e; + } + $visitorProfileEnabled = true; + } - $visitorProfileEnabled = $systemSettings->disableVisitorProfile->getValue() === false - && $systemSettings->disableVisitorLog->getValue() === false; if ($visitorProfileEnabled) { parent::configureSegments($segmentsList, $dimensionSegmentFactory); } |