From a4fa16eb9ba9454bf137da47e3d27228dc6b9a7c Mon Sep 17 00:00:00 2001 From: sgiehl Date: Sun, 2 Jul 2017 21:45:59 +0200 Subject: [PATCH] adds test to prove bandwidth is available in Live.getLastVisitsDetails report --- tests/Integration/BandwidthTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/Integration/BandwidthTest.php b/tests/Integration/BandwidthTest.php index 7502dc7..6612678 100644 --- a/tests/Integration/BandwidthTest.php +++ b/tests/Integration/BandwidthTest.php @@ -14,6 +14,7 @@ use Piwik\Plugin; use Piwik\Plugins\Bandwidth\API; use Piwik\Plugins\Bandwidth\tests\Framework\TestCase\IntegrationTestCase; +use Piwik\Version; /** * Bandidth Class and Bandwidth Tracker test @@ -107,6 +108,29 @@ public function test_shouldEnrichDownloads() $this->assertBandwidthStats($row, $maxB = 3949, $minB = 1, $sumB = 4362, $avgB = 872); } + public function test_shouldEnrichLiveActions() + { + if (!class_exists('\\Piwik\\Plugins\\Live\\VisitorDetailsAbstract')) { + $this->markTestSkipped('Extended Live reports not available in this Piwik version'); + } + + $this->trackPageviews(array(1, 10, null, 5, null, 3949, 399)); + + $params = array( + 'idSite' => 1, + 'period' => 'day', + 'date' => $this->date + ); + + $result = Request::processRequest('Live.getLastVisitsDetails', $params); + $row = $result->getFirstRow(); + + $actions = $row->getColumn('actionDetails'); + foreach ($actions as $action) { + $this->assertArrayHasKey('bandwidth', $action); + } + } + public function test_manyDifferentUrlsWithFolders_ShouldAggregateStats() { $tracker = $this->getTracker();