diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2016-02-02 17:09:41 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2016-02-02 17:09:41 +0300 |
commit | f9b0fc5ed23e87f3a49275ea6874b0bb774ce21f (patch) | |
tree | db0f9b0307d7ed66eab34f5cccd9fa8725ef6e2d /plugins/Live/tests/Integration | |
parent | 888ade738e5e1367406cf7865c5feb5da94ab0fd (diff) |
prevented display of visits to be ordered by most important dimension - Time when MetaSites plugin was enabled.
Diffstat (limited to 'plugins/Live/tests/Integration')
-rw-r--r-- | plugins/Live/tests/Integration/ModelTest.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/Live/tests/Integration/ModelTest.php b/plugins/Live/tests/Integration/ModelTest.php index 1bc14d6375..355f1fb777 100644 --- a/plugins/Live/tests/Integration/ModelTest.php +++ b/plugins/Live/tests/Integration/ModelTest.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\Live\tests\Integration; use Piwik\Common; +use Piwik\Piwik; use Piwik\Plugins\Live\Model; use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\Mock\FakeAccess; @@ -66,6 +67,48 @@ class ModelTest extends IntegrationTestCase $this->assertEquals(SegmentTest::removeExtraWhiteSpaces($expectedBind), SegmentTest::removeExtraWhiteSpaces($bind)); } + public function test_makeLogVisitsQueryString_withMultipleIdSites() + { + Piwik::addAction('Live.API.getIdSitesString', function (&$idSites) { + $idSites = array(2,3,4); + }); + + $model = new Model(); + list($sql, $bind) = $model->makeLogVisitsQueryString( + $idSite = 1, + $period = 'month', + $date = '2010-01-01', + $segment = false, + $offset = 0, + $limit = 100, + $visitorId = false, + $minTimestamp = false, + $filterSortOrder = false + ); + $expectedSql = ' SELECT sub.* FROM + ( + SELECT log_visit.* + FROM ' . Common::prefixTable('log_visit') . ' AS log_visit + WHERE log_visit.idsite in (?,?,?) + AND log_visit.visit_last_action_time >= ? + AND log_visit.visit_last_action_time <= ? + ORDER BY visit_last_action_time DESC + LIMIT 100 + ) AS sub + GROUP BY sub.idvisit + ORDER BY sub.visit_last_action_time DESC + '; + $expectedBind = array( + '2', + '3', + '4', + '2010-01-01 00:00:00', + '2010-02-01 00:00:00', + ); + $this->assertEquals(SegmentTest::removeExtraWhiteSpaces($expectedSql), SegmentTest::removeExtraWhiteSpaces($sql)); + $this->assertEquals(SegmentTest::removeExtraWhiteSpaces($expectedBind), SegmentTest::removeExtraWhiteSpaces($bind)); + } + public function test_makeLogVisitsQueryStringWithOffset() { $model = new Model(); |